Questions tagged [lines-of-code]

The number of code lines. Can be used as a metric.

The number of code lines. Generally, a set of metrics are placed to estimate the quality of coding. lines-of-code is one of the metrics used to determine for example if a class is too long or too short. This metric is not an accurate one and is most of the time used with other metrics such as the number of methods, number of static fields, etc.

170 questions
2
votes
5 answers

C Program to Count Lines of Code

I'm writing a simple LOC counter in C to count how many lines of code are in my C source files. It's meant to be run from the command line, redirecting the target file as input and seeing a total line count printed to standard out. For example: …
dvanaria
  • 6,593
  • 22
  • 62
  • 82
2
votes
2 answers

Counting lines of code per author in a git repository

So I'm in a team with a few other programmers and need to get a lines-of-code count per author in our git repository. That doesn't just mean lines modified by author, because that would include blank and comment lines. Ideally, I would be able to…
2
votes
0 answers

PhpStorm max function length

I need to set maximum length (in LOC) of function or class. For example, when my function has more than 20 lines, PhpStorm should show me some warning. I was looking for it in Settings->Editor->Inspections, but have not found anything like that for…
JaK
  • 133
  • 1
  • 7
2
votes
1 answer

using cloc to count lines of codes in sub folders

My Operating System is Windows. I have a main folder that contains projects within each sub folders. I want to report on each folder with foldername.txt. Then later I can sum them up with --sum-reports option. I looked at their options can't find a…
Meidi
  • 562
  • 1
  • 8
  • 28
2
votes
2 answers

How do the size standard libraries compare for different languages

Someone was recently raving about how great jQuery was and how it made javascript into a pleasure and also how the whole source code was so small(and one file). I looked it up on www.ohloh.net/ and it said it was about 30,000 lines of javascript,…
Roman A. Taycher
  • 18,619
  • 19
  • 86
  • 141
2
votes
0 answers

Extracting LOC metric with JDT in Eclipse

I'm trying to extract the number of lines from my source code in Eclipse with the jdt package. I found a similar question here : https://stackoverflow.com/questions/11126857/eclipse-astnode-to-source-code-line-number/11131452#11131452 Unni Kris…
Tristan
  • 1,349
  • 2
  • 16
  • 25
2
votes
0 answers

Program to count program sizes

I have to Write a program (in C#) to count (in LOC) the • total program size • total size of each of the program’s parts (classes, functions, or procedures) • the number of items (or methods) in each part. Produce and print • a single count for…
Jean
  • 593
  • 2
  • 6
  • 19
2
votes
1 answer

Why doesn't NDepend produce a stable LOC count?

I am using the NDepend 4.1 API to count the lines of code in a Visual Studio 2010 solution that has a few projects, which are all targeting the .NET Framework 4. Here's my code: var servicesProvider = new NDependServicesProvider(); var…
William Gross
  • 2,083
  • 2
  • 17
  • 35
2
votes
1 answer

count lines of code for each class in a python file?

I'm trying to find the count of lines of codes within a class in a python file .. I used the len(inspect.getsourcelines(b)[0]) to return the number of lines of code for each class in the file but the problem it counts comments and doc string in…
tkyass
  • 2,968
  • 8
  • 38
  • 57
1
vote
1 answer

In python, drop a time range period

I would like to drop 30 minutes of data after column is -1. I have a large dataset and I need to remove 30 minutes from the dataframe after the column 'diff' == -1 I have the following code: df12_3.head() index Timestamp Status_flag…
lourew
  • 65
  • 1
  • 1
  • 7
1
vote
1 answer

Create a column ranking order of records by date

Imagine I have the following dataframe with employees, their contract type (values could be Employee, Contractor and Agency). Also, one person can have more than 1 contract as you could see in the dataframe example below: ID Name Contract …
Paulo Cortez
  • 609
  • 4
  • 10
1
vote
1 answer

Confirm if LOV columns in a pandas dataframe complies with another mapping dataframe

I have 2 dataframes, one of them of employee information by Country, and another one with a mapping of possible values for LOV columns per country (depending on the country, the column may or may not be an LOV and accept different values and is case…
Paulo Cortez
  • 609
  • 4
  • 10
1
vote
1 answer

how can I call multiple columns from my data frame in pandas

I'm trying to get the top 10 longest songs in my data frame by calling two columns using the code df.loc[['duration_min','name']].head(). I have already sorted the relevant columns by descending order but when I run the code, I keep getting this…
1
vote
1 answer

Pandas update columns with loc and apply

I'm trying to update some columns of a dataframe where some condition is met (only some lines will meet the condition). I'm using apply with loc. My function returns a pandas series. The problem is that the columns are updates with NaN. Simplifying…
Pedro Cruz
  • 21
  • 2
1
vote
1 answer

Selecting dataframe columns with boolen, rest have to be false

I try to filter a dataframe with a specific condition, but don't now how to get safe that all other columns have to be false. A | B | C | D | E | F True True False False False False True False True False False True True True True False False…
L F
  • 13
  • 3