-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #37: inject, invoke maven command, read file and clean up #50
Conversation
truthfully I was thinking we would run a command line git execution instead of using JGit.
I didn't want to allow jgit everywhere as then someone will import it in the wrong place and think it is acceptable when it isn't. Import control is to restrict bad designs, not to limit our design possibilities.
Edit: I didn't look at source changes first.
No. If something is needed for testing, we should use reflection and break class that way than leave internal structure open for someone to mis-use. Production code should not be defined by tests except for maybe splitting things into smaller pieces. |
OK.
I agree with this.
Ya, I was thinking to use it. Already been investigating on it. |
@rnveach Updated. I don't use static method in Maybe we need to combine the another part of this issue then we could make test for all this updates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we going to finish this PR?
checkoutToPrBranch(); | ||
copyInjectFilesToCheckstyleRepo(); | ||
invokeMavenCommand(); | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
* Invokes Maven command to generate the extract info file in checkstyle repository. | ||
*/ | ||
private static void invokeMavenCommand() { | ||
// invoke maven command to generate the extract info file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to do something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. But have some problems. See my comments below.
pom.xml
Outdated
<regex> | ||
<pattern>com.github.checkstyle.regression.extract.CheckstyleInjector</pattern> | ||
<branchRate>0</branchRate> | ||
<lineRate>0</lineRate> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create issue to create some tests and coverage for this class at a later time.
@rnveach I encountered some strange problems:
|
remove
Cobertura sees main class and inner classes differently. Change line to something like: |
This is why I have said repeatedly, lets not worry about code coverage on cloning, maven, etc...
Why not set this as arguments to |
I add this in UT just for quick test and debug, I would remove it when I confirm the code function is acceptable.
I tried this but it doesn't work. Still has error |
It works. Thanks. :) |
} | ||
} | ||
|
||
//@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not leave commented code in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
returnValue = getModuleExtractInfosFromReader(reader); | ||
} | ||
catch (IOException ex) { | ||
throw new InjectException("unable to read to info file", ex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message is not very informative of issue.
Expand on what we were trying to do. Since it is the extract file, it should be in message somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
|
||
try { | ||
try { | ||
final File file = injector.generateExtractInfoFile(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if generateExtractInfoFile
doesn't throw an IOException
it should be outside the 2nd level try
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
<regex> | ||
<pattern>com.github.checkstyle.regression.extract.InjectException</pattern> | ||
<branchRate>0</branchRate> | ||
<lineRate>0</lineRate> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<regex> | ||
<pattern>com.github.checkstyle.regression.extract.CheckstyleInjector.*</pattern> | ||
<branchRate>0</branchRate> | ||
<lineRate>0</lineRate> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not seeing anything.
#37
This PR is just showing the abstract design thinking as mentioned at #37 (comment)
We need do the following things:
Problems:
git
. So should we create a util class ingit
and use it inextract
? If yes, we already have aGitUtils
in test scope, we might need to rename it to smth likeGitTestUtils
and create aGitUtils
for production code. If confirmed, we should make split issue for it and discuss there.CheckstyleInjector
is a temporary name. I haven't thought out a proper name currently. Please share your suggestion if you have good ideas of the name.getModuleExtractInfosFromReader
inExtractInfoProcessor
public, for we need this middleware method to create fake infos inModuleInfoCollectorTest
andModuleUtilsTest
.