C#: Remove libraries and queries related to version history

The VCS relations are no longer populated, so there is no reason to keep them,
and the queries/libraries that use the relations.
This commit is contained in:
Tom Hvitved
2019-07-02 10:16:30 +02:00
parent 71c86fa69b
commit 9a24d3a69c
30 changed files with 0 additions and 1113 deletions

View File

@@ -1,25 +0,0 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>This metric measures the number of lines of text that have been added, deleted or modified in
files below this location in the tree.</p>
<p>Code churn is known to be a good predictor of defects in a code component. The idea is that
files, packages or projects that have experienced a disproportionately high amount of churn for the
amount of code involved may have been harder to write, and are thus likely to contain more defects.
</p>
</overview>
<recommendation>
<p>Although it is probably not possible to reduce the level of change for a component, components
with a high churn should be subject to more rigorous testing and review.</p>
</recommendation>
<references>
<li>N. Nagappan et al. <em>Change Bursts as Defect Predictors</em>. In Proceedings of the 21st IEEE International Symposium on Software Reliability Engineering, 2010.</li>
</references>
</qhelp>

View File

@@ -1,21 +0,0 @@
/**
* @name Churned lines
* @description Number of churned lines, across the revision history in the database.
* @kind treemap
* @treemap.warnOn highValues
* @metricType file
* @metricAggregate avg sum max
* @id cs/vcs/churn-per-file
*/
import csharp
import external.VCS
from File f, int n
where
n = sum(Commit entry, int churn |
churn = entry.getRecentChurnForFile(f) and not artificialChange(entry)
|
churn
)
select f, n order by n desc

View File

@@ -1,6 +0,0 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<include src="HChurn.qhelp" />
</qhelp>

View File

@@ -1,21 +0,0 @@
/**
* @name Added lines
* @description Number of added lines, across the revision history in the database.
* @kind treemap
* @treemap.warnOn highValues
* @metricType file
* @metricAggregate avg sum max
* @id cs/vcs/added-lines-per-file
*/
import csharp
import external.VCS
from File f, int n
where
n = sum(Commit entry, int churn |
churn = entry.getRecentAdditionsForFile(f) and not artificialChange(entry)
|
churn
)
select f, n order by n desc

View File

@@ -1,6 +0,0 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<include src="HChurn.qhelp" />
</qhelp>

View File

@@ -1,21 +0,0 @@
/**
* @name Deleted lines
* @description Number of deleted lines, across the revision history in the database.
* @kind treemap
* @treemap.warnOn highValues
* @metricType file
* @metricAggregate avg sum max
* @id cs/vcs/deleted-lines-per-file
*/
import csharp
import external.VCS
from File f, int n
where
n = sum(Commit entry, int churn |
churn = entry.getRecentDeletionsForFile(f) and not artificialChange(entry)
|
churn
)
select f, n order by n desc

View File

@@ -1,21 +0,0 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>This metric measures the number of different authors for files below this location in the tree.
This information is extracted from the version control system used to manage the source code.</p>
<p>Files that have been changed by a large number of different authors are by definition the
product of many minds. New authors working on a file may be less familiar with the design and
implementation of the code than the original authors, which can be a potential source of defects.
Furthermore, code that has been worked on by many people, if not carefully maintained, often ends
up lacking conceptual integrity.</p>
</overview>
<recommendation>
<p>Files with a high value for this metric should be given special attention in a code review, and
may ultimately be good candidates for refactoring/rewriting by an individual, experienced developer.
</p>
</recommendation>
</qhelp>

View File

@@ -1,15 +0,0 @@
/**
* @name Number of authors (version control)
* @description The number of distinct authors (by version control history) below this location in the tree
* @kind treemap
* @treemap.warnOn highValues
* @metricType file
* @metricAggregate avg min max
* @id cs/vcs/authors-per-file
*/
import csharp
import external.VCS
from File f
select f, count(Author author | author.getAnEditedFile() = f)

View File

@@ -1,16 +0,0 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>This metric measures the number of commits that have affected each file below this location in
the tree.</p>
<p>Files that have been changed a large number of times may have had a large number of defects in
the past and may have more in the future.</p>
</overview>
<recommendation>
<p>Files with a high value for this metric should be given special attention in a code review.</p>
</recommendation>
</qhelp>

View File

@@ -1,15 +0,0 @@
/**
* @name Number of file-level changes
* @description The number of file-level changes made (by version control history).
* @kind treemap
* @treemap.warnOn highValues
* @metricType file
* @metricAggregate avg min max sum
* @id cs/vcs/commits-per-file
*/
import csharp
import external.VCS
from File f
select f, count(Commit svn | f = svn.getAnAffectedFile() and not artificialChange(svn))

View File

@@ -1,28 +0,0 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>This metric measures the average number of other files changed when a file itself is changed.
Files that cause a lot of other files to be changed may be too tightly bound to those other files.
</p>
<p>It is important to note that this metric is an average for all commits of a file. When picking
aggregation method to examine a directory of files in the source tree, this still applies. This
means that if you use the 'max' aggregation method on a directory you will be presented with the
metric for the file with the highest average number of co-commits across the files entire commit
history.</p>
</overview>
<recommendation>
<p>Files with a high value for this metric may have a widely used public API. Special care
should therefore be taken when updating it to ensure any other parts of the program that use the
API are also updated.</p>
<p>It is also possible that the file is too tightly coupled with other files. Examine the afferent
and efferent coupling metrics as well and consider the advice given.</p>
<p>A final possibility is that committers could be using single commits to introduce several
unrelated changes. If this is the case then commit practices should be reviewed.</p>
</recommendation>
</qhelp>

View File

@@ -1,17 +0,0 @@
/**
* @name Number of co-committed files
* @description The average number of other files that are touched whenever a file is affected by a commit
* @kind treemap
* @treemap.warnOn highValues
* @metricType file
* @metricAggregate avg min max
* @id cs/vcs/co-commits-per-file
*/
import csharp
import external.VCS
int committedFiles(Commit commit) { result = count(commit.getAnAffectedFile()) }
from File f
select f, avg(Commit commit | commit.getAnAffectedFile() = f | committedFiles(commit) - 1)

View File

@@ -1,22 +0,0 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>This metric measures the number of times files were recommitted after being committed once. A
change to a file is considered a recommit if it occurs within 5 days of a previous commit on the
same file.</p>
<p>Provided changes are not being committed until they are considered complete then a high number
of recommits might indicate that attempts to update some code proved difficult and had to be
reattempted several times.</p>
</overview>
<recommendation>
<p>A high value for this metric often indicates files that required several commits to implement a
change. These files would benefit from rigorous testing and review.</p>
<p>It is possible the recommits were several unrelated changes to a large and central source file.
If this is the case then splitting the file up should be considered.</p>
</recommendation>
</qhelp>

View File

@@ -1,33 +0,0 @@
/**
* @name Number of file re-commits
* @description A re-commit is taken to mean a commit to a file that was touched less than five days ago.
* @kind treemap
* @treemap.warnOn highValues
* @metricType file
* @metricAggregate avg min max
* @id cs/vcs/recommits-per-file
*/
import csharp
import external.VCS
predicate inRange(Commit first, Commit second) {
first.getAnAffectedFile() = second.getAnAffectedFile() and
first != second and
exists(int n |
n = first.getDate().daysTo(second.getDate()) and
n >= 0 and
n < 5
)
}
int recommitsForFile(File f) {
result = count(Commit recommit |
f = recommit.getAnAffectedFile() and
exists(Commit prev | inRange(prev, recommit))
)
}
from File f
where f.getExtension() = "c"
select f, recommitsForFile(f)

View File

@@ -1,16 +0,0 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>This metric measures the number of recent changes to files that have occurred below this
location in the tree. A recent change is taken to mean a change that has occurred in the last 180
days. All code that has changed a great deal may be more than usually prone to defects, but this is
particularly true of code that has been changing dramatically in the recent past, because it has
not yet had a chance to be properly field-tested.</p>
</overview>
<recommendation>
<p>Files with a high value for this metric should be given special attention in a code review.</p>
</recommendation>
</qhelp>

View File

@@ -1,19 +0,0 @@
/**
* @name Number of recent file changes
* @description Number of recent commits to this file
* @kind treemap
* @treemap.warnOn highValues
* @metricType file
* @metricAggregate avg min max sum
* @id cs/vcs/recent-commits-per-file
*/
import csharp
import external.VCS
from File f, int n
where
n = count(Commit e |
e.getAnAffectedFile() = f and e.daysToNow() <= 180 and not artificialChange(e)
)
select f, n order by n desc