-
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 #21: Report Component #48
Conversation
da622e2
to
4f558e2
Compare
I think we may need to take the contribution repo as an argument in Main. |
@Luolc ping |
98f4538
to
32ac855
Compare
Some discussion on Gitter:
Invoking script with We mentioned deployment should be in this component, and are we going to use the build-in deploy function in Travis currently? If yes, then this should be done by changes of |
Please mention if you added something to issue like new argument. Since you edited, I didn't get a notification of the change.
This will be a separate PR and we should only worry about this later.
Please explain this as I am not sure what you mean by "built-in deploy". IMO, we should probably have different methods for deploy taken as arguments. |
<regex> | ||
<pattern>com.github.checkstyle.regression.report.ReportGenerator</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.
* @throws IOException failure of running CLI | ||
*/ | ||
public static File generate( | ||
String testerPath, String repoPath, String branch, String configPath) |
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.
https://github.com/checkstyle/regression-tool/blob/master/src/main/java/com/github/checkstyle/regression/configuration/ConfigGenerator.java#L126
Shouldn't configPath
be a file?
I am unsure of other paths since we don't have code in Main
. They should be converted to a File
at some point to test if they exist and such.
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 OK with a File
parameter. Is there any possibility that user might use his own config file and don't use the generated one?
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.
Is there any possibility that user might use his own config file and don't use the generated one?
It is a possibility, but like I stated, anything that comes from user has to converted to a File
at some point to test if it exists and such. We should probably do this sooner rather than later.
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. It is now a File
type. And I add a check of the existence. Do you think it is proper to check here, or in Main
, before passing it to the method?
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.
Main
should do all validation to check if inputs are correct.
) | ||
.inheritIO(); | ||
final Process process = builder.start(); | ||
final int code = process.waitFor(); |
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.
Will users' see output of groovy command?
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.
Yes. inheritIO()
makes users see output of the CLI. We could remove inheritIO()
if we don't want user see the output.
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.
They need to see output as any error will be in groovy and not displayed by our process.
This is why I wanted to confirm.
final Process process = builder.start(); | ||
final int code = process.waitFor(); | ||
if (code != 0) { | ||
throw new IllegalStateException("an error occurs when running diff.groovy"); |
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.
occurs
=> occurred
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.
config/pmd.xml
Outdated
<rule ref="rulesets/java/controversial.xml/UseObjectForClearerAPI"> | ||
<properties> | ||
<!-- Considering fix this later, since the interface might be changed. --> | ||
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='ReportGenerator']"/> |
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.
Make issue.
Or if will be possibly fixed in this issue,make note of it in 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.
This is removed after we changed parameter configPath
to a File
type.
String testerPath, String repoPath, String branch, File configFile) | ||
throws InterruptedException, IOException { | ||
if (!configFile.exists()) { | ||
throw new IllegalArgumentException("config file does not exist: " + configFile); |
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.
Like I said, Main
should do all validation and testing to check if inputs are valid.
All components should assume it is given valid information.
Please remove this if
check.
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.
if (code != 0) { | ||
throw new IllegalStateException("an error occurred when running diff.groovy"); | ||
} | ||
return new File(testerPath, "reports/diff"); |
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.
Should we test if it exists and is directory before continuing? We don't want to return bad data.
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.
OK. Done.
final Process process = new ProcessBuilder() | ||
.directory(new File(testerPath)) | ||
.command( | ||
"groovy", "diff.groovy", |
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.
One final thing, let's make a new issue on using GroovyShell.
Please include all details and any supporting documentation or stack overflows.
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.
#21
This is not a completed PR currently.
As mentioned at #21 (comment), I wrote some code to download the script from remote repo. And actually it is not so different with putting it in our project directly. I assume we would only need
diff.groovy
in the contribution repo(and list of repos to test on), is it correct?I think I need more discussion about this component. And here is the simple script downloading code, in case you have any suggestions about this.