mauricioaniche / ck Goto Github PK
View Code? Open in Web Editor NEWCode metrics for Java code by means of static analysis
License: Apache License 2.0
Code metrics for Java code by means of static analysis
License: Apache License 2.0
Hi,
I am using your software and i'm finding it very usefull but for it to have actually all ck metrics it should have also NOC and your old version that had it doesn't analyze the inner classes so it's not usable in combo with the newer version. Could you maybe reimplement it in the newer version so that it also does it for inner classes?
Hi,
Sometimes it is only necessary to refactor in the main part of your application, and the tests don't necessarily need to be refactored. It would be nice if there was an option to ignore test classes, and just produce the metrics for the main code. Is this possible?
Sometimes JDT is able to resolve the qualified name, sometimes it returns the simple name. My guess is that in our tests, we don't have folders for the packages. See if same thing happens in a real code.
If a class contains a subclass, the number of unique words include the number of words in the subclasses too. That's not a wanted behaviour.
See test WordCountsTest#subclasses
. The test is already there.
I just noticed by accident that there is maxNestedBlocks
for method level while its class counterpart is maxNestedBlocksQty
.
ck/src/main/java/com/github/mauricioaniche/ck/ResultWriter.java
Lines 17 to 22 in 1dd7a4b
IMO the suffix Qty
should be added for consistency as the other metrics.
Need to handle static initializer as well
Sometimes AST cannot be parsed (due to file with syntax error/ new syntax, given by new Java version).
If it is the case, the program crashes and methods.csv is empty:
If I set max partitions to 1, it didn't help. Setting JLS14 didn't help.
Exception in thread "main" java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getPackage0(PackageBinding.java:176)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createPlainPackage(LookupEnvironment.java:1126)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.buildTypeBindings(CompilationUnitScope.java:135)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.buildTypeBindings(LookupEnvironment.java:475)
at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:340)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.accept(CompilationUnitResolver.java:186)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:334)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:276)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:3464)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:3175)
at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:57)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:536)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:638)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:634)
at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:293)
at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:270)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:664)
at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:361)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:573)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1490)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1615)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:662)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:902)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1044)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:662)
at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:1001)
at com.github.mauricioaniche.ck.CK.calculate(CK.java:109)
at com.github.mauricioaniche.ck.CK.calculate(CK.java:59)
at com.github.mauricioaniche.ck.Runner.main(Runner.java:34)
Could you please handle the exception and continue the flow (the bad file will be just ignored and not included into csv)?
And if partitions are set to some value (not 1), you should ignore only 1 file, not the whole partition
Hello,
I find a conflict between your implementation of CBO and the definition of the original CK paper. In the paper, authors say "CBO for a class is a count of the number of other classes to which it is coupled where two classes are coupled if methods declared in one class use methods or instance variables defined by the other class."
When try to use standalone version with command:
java -jar ck-x.x.x-SNAPSHOT-jar-with-dependencies.jar <project dir>
The program returns the following message:
log4j:WARN No appenders could be found for logger (com.github.mauricioaniche.ck.CK).
log4j:WARN Please initialize the log4j system properly.
Hello,
There seems to be an issue with writing the metrics for class results in the file https://github.com/mauricioaniche/ck/blob/master/src/main/java/com/github/mauricioaniche/ck/ResultWriter.java. Some values are shifted. For example, result.getVisibleMethods().size() is written where abstractMethodsQty should be, abstractMethodsQty is written where finalMethodsQty should be and so on. The majority of metrics are ok; this affects just the abstract method quantity and the fields' numbers.
This is what the CSV row should look like according to the header:
private static final String[] CLASS_HEADER = { "file", "class", "type", "cbo", "wmc", "dit", "rfc", "lcom", "tcc", "lcc", "totalMethodsQty", "staticMethodsQty", "publicMethodsQty", "privateMethodsQty", "protectedMethodsQty", defaultMethodsQty", "abstractMethodsQty", "finalMethodsQty", "synchronizedMethodsQty", "totalFieldsQty", "staticFieldsQty", "publicFieldsQty", "privateFieldsQty", "protectedFieldsQty", "defaultFieldsQty", "visibleFieldsQty", "finalFieldsQty", "synchronizedFieldsQty", "nosi", "loc", "returnQty", "loopQty", "comparisonsQty", "tryCatchQty", "parenthesizedExpsQty", "stringLiteralsQty", "numbersQty", "assignmentsQty", "mathOperationsQty", "variablesQty", "maxNestedBlocksQty", "anonymousClassesQty", "innerClassesQty", "lambdasQty", "uniqueWordsQty", "modifiers", "logStatementsQty" };
and this is the actual row (differences are bolded):
this.classPrinter.printRecord(result.getFile(), result.getClassName(), result.getType(), result.getCbo(), result.getWmc(),
result.getDit(), result.getRfc(), result.getLcom(), result.getTightClassCohesion(), result.getLooseClassCohesion(),
result.getNumberOfMethods(), result.getNumberOfStaticMethods(), result.getNumberOfPublicMethods(),
result.getNumberOfPrivateMethods(), result.getNumberOfProtectedMethods(),
result.getNumberOfDefaultMethods(), result.getVisibleMethods().size(), result.getNumberOfAbstractMethods(),
result.getNumberOfFinalMethods(), result.getNumberOfSynchronizedMethods(), result.getNumberOfFields(),
result.getNumberOfStaticFields(), result.getNumberOfPublicFields(), result.getNumberOfPrivateFields(),
result.getNumberOfProtectedFields(), result.getNumberOfDefaultFields(), result.getNumberOfFinalFields(),
result.getNumberOfSynchronizedFields(), result.getNosi(), result.getLoc(), result.getReturnQty(),
result.getLoopQty(), result.getComparisonsQty(), result.getTryCatchQty(),
result.getParenthesizedExpsQty(), result.getStringLiteralsQty(), result.getNumbersQty(),
result.getAssignmentsQty(), result.getMathOperationsQty(), result.getVariablesQty(),
result.getMaxNestedBlocks(), result.getAnonymousClassesQty(), result.getInnerClassesQty(),
result.getLambdasQty(), result.getUniqueWordsQty(), result.getModifiers(), result.getNumberOfLogStatements());
Take the example of this real-world class: HectorPolicyManagerImpl, also in our repo.
The method getAllPolicies
declares an anonymous class in line 113. CK calls it net.retakethe.policyauction.data.impl.HectorPolicyManagerImpl$Anonymous1
.
That's too generic. Maybe a better name would be net.retakethe.policyauction.data.impl.HectorPolicyManagerImpl.getAllPolicies.filter$Anonymous1
.
check if it already happens
Hi,
I am using this library for research and I need to find the method-level metrics, so I am traversing the CKClassResult
by using getMethods
function to find the metric values of desired methods, but I have found that this method does not return methods that are inside of an inner class. Is there any way to get those methods?
Thanks
I was not able to find a Java version support table for your library, does it exist somewhere? If not, maybe it would be nice to have such information in your README.md
.
Suppose a class that only contains fields. CK returns -1 to some metrics (e.g., maxNestedBlocks). It should be zero.
Failed tests:
NOCTest.should_detect_children:28 expected:<1> but was:<0>
Hello, I am using your tool for my project. While running it on the repository https://github.com/eclipse/eclipse-collections, commit “617cd8e” I got “Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3000”
git clone -b master --single-branch https://github.com/eclipse/eclipse-collections
git checkout -f 617cd8e
And run ck program for that repository snapshot
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3000
at org.eclipse.jdt.internal.compiler.ClassFile.generateBootstrapMethods(ClassFile.java:2965)
at org.eclipse.jdt.internal.compiler.ClassFile.addAttributes(ClassFile.java:387)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:577)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:635)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:368)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:781)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1005)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:636)
at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:990)
at com.github.mauricioaniche.ck.CK.calculate(CK.java:82)
at com.github.mauricioaniche.ck.Runner.main(Runner.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Let's write more tests to see if CK correctly counts synchronised classes, methods, fields, etc etc.
We can add information related to exceptions:
Hi all
Firstly, many thanks for this powerful tool that helps us in our researches.
I tried to add Gradle dependency to my Java implementation to use this library. I got this issue when I tried to build the project.
I tried many solutions and I gave up. Can you please help me to solve it?
I used intellij IDM, Java 1.8 and javac 1.8.0_201.
Thanks,
cannot access CK bad class file: C:\Users\GIGABYTE.gradle\caches\modules-2\files-2.1\com.github.mauricioaniche\ck\0.4.3\3363cb42f4417452fe749730dc813f68c658a840\ck-0.4.3.jar(com/github/mauricioaniche/ck/CK.class) class file has wrong version 55.0, should be 52.0 Please remove or make sure it appears in the correct subdirectory of the classpath.
I've been playing with this a little bit this week. In the method.csv
that is output, the method identifiers look something like this:
getValue/3[int[],int[],String]
, which I guess maps to name/#params[param1,param2,param3]
. This is good because, along with the class
attribute, this gives you a unique identifier for the method.
However, the commas inside the square brackets are likely to throw off CSV parsers. Specifically, it looks to pandas like there are more values than fields in the line with the "extra" commas. I have confirmed that neither pandas nor R are able to read the file.
This can be dealt with with some file processing, but I think it would be better to output an "analysis-ready" file. Would you be open to a PR that changes those commas to some other character, say semi-colons?
This issue is easy to reproduce using the codebase of the current snapshot, so I don't attach any code or screenshot.
I believe it is a bug, since the toggle for variables and field metrics should not affect the results for class-level metrics.
Will make PRs if I can fix it.
Hello,
I think there is a problem in calculating the WMC metric based on cyclomatic complexity.
For example, consider the following methods:
public class CC6 {
public boolean m1(int a) {
if (0 <= a && a <= 10) {
return true;
}
return false;
}
public boolean m2(int a) {
boolean cond = (0 <= a && a <= 10);
if (cond) {
return true;
}
return false;
}
public boolean m3(int a) {
if (0 <= a <= 10) {
return true;
}
return false;
}
}
All these three methods do the same thing. However, the WMC complexities for m1,m2, and m3 are 3,2, and 2 respectively. In fact, the following inline conditional statement
boolean cond = (0 <= a && a <= 10);
does not increase CC complexity at all. Furthermore, when a condition becomes compact such as
if (0 <= a <= 10)
you increase CC complexity just by one. I know the original paper does not take into account situations like that. However, don't you think it would be better to consider that?
I identified some bad code smells in your project, I would like to help.
The ClassInfo
class currently gets the name of the class whenever a ClassDeclaration is visited. I'd say we need a lock there to make sure we only get the name of the main class.
Investigating the output of one experiment I found one weird behavior.
A class that has 36 fields, but with 0 public, private, protected and default fields.
I debugged and I found that all the fields were default, but the condition isDefault failed for all of them.
I'm not an expert in JDT, so I don't know how to fix. I also added a new test case to ensure that the number of fields is equal to the sum of private, public, protected and default fields.
Output:
Hello,
I think there is a difference between your implementation of RFC and the original paper. In the paper, authors count the number of unique invocations plus the set of all methods in the class .
CKVisitor is the one that JDT invokes whenever it visits a Node. CKVisitor then calls the visits inside each of the metrics. So, CKVisitor should propagate all calls to visitX()
or endVisitX()
, in the metrics.
It's a boring copy-and-paste task, but we need to add all of them for the endVisits()
as we still miss some. I have been adding them on-demand (i.e., whenever a metric needs it, I add it). Of course, it always takes me 15 minutes to notice that a bug that is caused simply because the method is not being called.
This Travis CI build fails with the following error:
[ERROR] /home/travis/build/AntoniosBarotsis/ck/src/main/java/com/github/mauricioaniche/ck/CK.java:[105,63] cannot access org.eclipse.core.runtime.Plugin
bad class file: /home/travis/.m2/repository/org/eclipse/platform/org.eclipse.core.runtime/3.24.0/org.eclipse.core.runtime-3.24.0.jar(org/eclipse/core/runtime/Plugin.class)
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
Raw logs can be found here.
This fails due to the project using Java 8, switching the version to 11 or above fixes the issue. I was personally using a higher version and did not notice the build failure.
I can't find information on the Maven repository or their website on which version of Java each version was compiled with.
Exception in thread "main" java.lang.NullPointerExceptionat com.github.mauricioaniche.ck.FileUtils.getAllDirs(FileUtils.java:23)
at com.github.mauricioaniche.ck.FileUtils.getAllDirs(FileUtils.java:11)
at com.github.mauricioaniche.ck.CK.calculate(CK.java:52)
at com.github.mauricioaniche.ck.Runner.main(Runner.java:18)
I am running mvn clean package
on HEAD 17b80cb
which fails due to a failing test.
-------------------------------------------------------------------------------
Test set: com.github.mauricioaniche.ck.NOCTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.012 s <<< FAILURE! - in com.github.mauricioaniche.ck.NOCTest
shouldDetectChildren Time elapsed: 0.009 s <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: <1> but was: <2>
at com.github.mauricioaniche.ck.NOCTest.shouldDetectChildren(NOCTest.java:19)
This happens on both a JDK11 and JDK16 Maven runner. Similarly, if I run the tests through IntelliJ, this is the only test that fails.
By definition, the CC metric does not take into account the nesting levels of the method. For example, consider the following Python source code:
public int getPayAmount() {
int result = 0;
if (isDead)
result = deadAmount();
else {
if (isSeparated)
result = separatedAmount();
else {
if (isRetired)
result = retiredAmount();
else
result = normalPayAmount();
}
}
return result;
}
By refactoring this code, we get:
public void getPayAmount() {
if (isDead) return deadAmount();
if (isSeparated) return separatedAmount();
if (isRetired) return retiredAmount();
return normalPayAmount();
}
As you can see, By applying a popular technique named Replace Nested Conditional with Guard Clauses, the source code structure would improve a lot. However, the CC metric does not change (by definition).
Some researchers have proposed a few solutions. Surprisingly, the best solution (in my opinion) has the minimum citation link .
See class https://github.com/mauricioaniche/ck/blob/master/fixtures/real-world/ByteBufferAsyncWritableChannel.java. It contains a subclass ChunkData
. If we call getMethodInvocationsLocal()
to the ChunkData/2
constructor, it returns null.
I believe that's a bug.
CK is a simple tool; yet, people's code are complicated!! Although our test suite has been growing, there are always exceptional cases that might lead the tool to bring strange results.
If you are looking for a way to start contributing to this project, I suggest you to write tests!! Our test suite is full of examples! In practice, all you need to do is:
/fixture
folderSubmit your tests as a PR!
If you found a bug,** THANK YOU**! Feel free to fix it yourself! If you can't, no worries. Just open an issue, and I'll work on that!
I really like the code metric analysis tool developed by your team, which is both lightweight and efficient. However, during the process of statistical analysis of code metrics, I didn't quite understand some of the metrics, and I tried to search for related documents, but failed. They are:
Do we really need it?
I noticed that methods.csv
generates startLine
and line
with the same values... Looking closer to the source file, I noticed the duplicate call to method.getStartLine()
.
Suppose we have a generic class Box
. The CBO
returns 2 for the following class:
public class Coupling6 {
private Box<Integer> integerBox = new Box<Integer>();
}
However, I think it should return one.
Sometimes, running CK will cause:
Exception in thread "main" java.lang.IllegalStateException: invalid environment settings
at org.eclipse.jdt.core.dom.ASTParser.getClasspath(ASTParser.java:259)
at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:1001)
at com.github.mauricioaniche.ck.CK.calculate(CK.java:113)
at com.github.mauricioaniche.ck.CK.calculate(CK.java:62)
at com.github.mauricioaniche.ck.Runner.main(Runner.java:43)
For the cause of this, see this reply
Sometimes, running CK will cause:
Exception in thread "main" java.lang.IllegalStateException: invalid environment settings
at org.eclipse.jdt.core.dom.ASTParser.getClasspath(ASTParser.java:259)
at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:1001)
at com.github.mauricioaniche.ck.CK.calculate(CK.java:113)
at com.github.mauricioaniche.ck.CK.calculate(CK.java:62)
at com.github.mauricioaniche.ck.Runner.main(Runner.java:43)
This occurs arbitrarily, it was working on my machine, now it does not. A groupmate tried the exact same script on his laptop, where it worked, but it did not work on his desktop.
We run the following inside our repository/metrics
folder:
java -jar ck.jar ../ false 0 false ./output/
This is run on java version "11.0.6" 2020-01-14 LTS
.
Inside of CK#calculate(Path, CKNotifier, Path...)
the paths to the .java files are all correct. There are no files there that should not be there.
Curiously enough, ASTParser
is not 1000+ lines so the stacktrace is hard to follow. The method looks as such:
Main main = new Main(new PrintWriter(System.out), new PrintWriter(System.err), false, (Map)null, (CompilationProgress)null);
ArrayList allClasspaths = new ArrayList();
try {
if ((this.bits & 32) != 0) {
Util.collectRunningVMBootclasspath(allClasspaths);
}
int i;
int max;
if (this.sourcepaths != null) {
i = 0;
for(max = this.sourcepaths.length; i < max; ++i) {
String encoding = this.sourcepathsEncodings == null ? null : this.sourcepathsEncodings[i];
main.processPathEntries(4, allClasspaths, this.sourcepaths[i], encoding, true, false);
}
}
if (this.classpaths != null) {
i = 0;
for(max = this.classpaths.length; i < max; ++i) {
main.processPathEntries(4, allClasspaths, this.classpaths[i], (String)null, false, false);
}
}
ArrayList pendingErrors = main.pendingErrors;
if (pendingErrors != null && pendingErrors.size() != 0) {
throw new IllegalStateException("invalid environment settings");
} else {
return allClasspaths;
}
} catch (IllegalArgumentException var6) {
throw new IllegalStateException("invalid environment settings", var6);
}
It seems that pendingErrors
is causing the problem, but the exception is supremely unhelpful and I have no idea what is going wrong. I have tried updating JDT but I cannot even find where it is released, their JavaDoc for the version I need is as good as non-existent.
If anyone has faced this problem before and knows how to resolve it, please let me know. Otherwise, I will continue to look into it.
What CK actually calculates in the subclass is the number of inner classes a class has.
We should:
This introduces breaking changes, but they are for the good.
As an optional parameter, the user might decide to use the jars in the directory of the project as a source for JDT to do better binding resolving.
Suggestion: pass a boolean. If true, CK scans the directory of the project, and feeds all JAR files to JDT.
There can be more than one static initialiser in a class. Right now, CK understands both, but gives them the same name: "(initializer)". It should give different names, e.g., (initializer 1), (initializer 2), ...
CK does not find classes if the folder structure is as follows: ambry/ambry-messageformat/src/main/java/com.github.ambry.messageformat/
.
I noticed this bug during the data-collection where it occurred quite frequently.
/data-collection_worker_1 2020-05-19 06:56:04 ERROR RefactoringAnalyzer:242 CK did not find class com.github.ambry.messageformat.MessageFormatSend/null
{refactoring: Change Variable Type headerFormat : MessageFormat.MessageHeader_Format_V1 to headerFormat : MessageFormatRecord.MessageHeader_Format_V1 in method private calculateOffsets() : void in class com.github.ambry.messageformat.MessageFormatSend commit: c612f30db3f4c49f2b302417725456c6005f1060 from project: Project{id=1409, datasetName='github', gitUrl='https://github.com/linkedin/ambry', projectName='ambry', dateOfProcessing=java.util.GregorianCalendar[time=1589871161821,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Etc/UTC",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2020,MONTH=4,WEEK_OF_YEAR=21,WEEK_OF_MONTH=4,DAY_OF_MONTH=19,DAY_OF_YEAR=140,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=3,AM_PM=0,HOUR=6,HOUR_OF_DAY=6,MINUTE=52,SECOND=41,MILLISECOND=821,ZONE_OFFSET=0,DST_OFFSET=0]', finishedDate=null', commits=2735', commitCountThresholds=[15, 20, 25, 30, 35, 40, 45, 50]', javaLoc=155896', numberOfProductionFiles=622', numberOfTestFiles=328', productionLoc=74200', testLoc=81696', exceptionsCount=0', lastCommitHash=36b2d5b6aa4265ec3a7b450dc633059160ac68d3', isInconsistent=false'}
/data-collection_worker_5 2020-05-18 18:23:03 ERROR RefactoringAnalyzer:242 CK did not find class im.actor.model.network.mtp.AuthIdRetriever.requestAuthId.createConnection/null
{refactoring: Change Variable Type bis : ByteArrayInputStream to dataInput : DataInput in method public onMessage(data byte[], offset int, len int) : void in class im.actor.model.network.mtp.AuthIdRetriever.requestAuthId.createConnection commit: 8c859310a55ddb057714514fb545a28037d86cc8 from project: Project{id=388, datasetName='github', gitUrl='https://github.com/actorapp/actor-platform', projectName='actor-platform', dateOfProcessing=java.util.GregorianCalendar[time=1589826144296,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Etc/UTC",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2020,MONTH=4,WEEK_OF_YEAR=21,WEEK_OF_MONTH=4,DAY_OF_MONTH=18,DAY_OF_YEAR=139,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=6,HOUR_OF_DAY=18,MINUTE=22,SECOND=24,MILLISECOND=296,ZONE_OFFSET=0,DST_OFFSET=0]', finishedDate=null', commits=8308', commitCountThresholds=[15, 20, 25, 30, 35, 40, 45, 50]', javaLoc=156980', numberOfProductionFiles=2218', numberOfTestFiles=14', productionLoc=156095', testLoc=885', exceptionsCount=0', lastCommitHash=5123c1584757c6eeea0ed2a0e7e043629871a0c6', isInconsistent=false'}
/data-collection_worker_21 2020-05-18 13:21:05 ERROR RefactoringAnalyzer:242 CK did not find class com.example.android.persistence.ui.ProductAdapter.setProductList.result.calculateDiff/null
{refactoring: Rename Variable old : Product to oldProduct : Product in method public areContentsTheSame(oldItemPosition int, newItemPosition int) : boolean in class com.example.android.persistence.ui.ProductAdapter.setProductList.result.calculateDiff commit: e64d25eca8e1fa218344e769c4aedfa995002ffd from project: Project{id=51, datasetName='github', gitUrl='https://github.com/googlesamples/android-architecture-components', projectName='android-architecture-components', dateOfProcessing=java.util.GregorianCalendar[time=1589808063556,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Etc/UTC",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2020,MONTH=4,WEEK_OF_YEAR=21,WEEK_OF_MONTH=4,DAY_OF_MONTH=18,DAY_OF_YEAR=139,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=1,HOUR_OF_DAY=13,MINUTE=21,SECOND=3,MILLISECOND=556,ZONE_OFFSET=0,DST_OFFSET=0]', finishedDate=null', commits=458', commitCountThresholds=[15, 20, 25, 30, 35, 40, 45, 50]', javaLoc=4028', numberOfProductionFiles=63', numberOfTestFiles=26', productionLoc=2603', testLoc=1425', exceptionsCount=0', lastCommitHash=f1ec5c2f75ed2a9663f627874142942cdaec2262', isInconsistent=false'}
The pitest-maven dependency has been added in version 0.5.0 (line 107 in the pom), it's a plugin and not a library.
<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.4.11</version>
</dependency>
I tryed to use the new version 0.6.2 with my maven plugin for CK, but it's not possible to compile anymore, because pitest-maven uses old maven libraries. ERROR : The API of the mojo scanner is not compatible with this plugin version.
I think it's very important to remove this dependency(too many sub-dependencies), but not the plugin, pitest is very cool to validate the tests.
Hi @mauricioaniche
I am writing tests for NumberOfMaxNestedBlock.java
. I have come accross the following issue:
class NestedBlocks8 {
public void m1() {
List<Integer> integers = Arrays.asList(3, 9, 7, 6, 10, 20);
integers.forEach(i -> System.out.println(50 / i));
}
}
I expect that the max depth of m1()
equals one. However, the getMaxNestedBlocks()
returns zero. Indeed, It happens when the enhanced version of For
along with a lambda function is employed.
Failed tests:
NOCTest.should_detect_children:26 expected:<2> but was:<0>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.