Skip to content
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

Share in documentaiton ability to validate few last commits #351

Open
romani opened this issue Nov 12, 2022 · 0 comments
Open

Share in documentaiton ability to validate few last commits #351

romani opened this issue Nov 12, 2022 · 0 comments

Comments

@romani
Copy link
Member

romani commented Nov 12, 2022

detected at checkstyle/eclipse-cs#350

Pull request contains several commits.
on local history is linear, so patch using your last commit ONLY.
in Travis CI, all commits are combined as one merge commit that is applied over master HEAD (it is non configurable feature of Travis) to not execute CI on old code and clearly know result after merge.

how to generate last commit file in maven:
https://github.com/checkstyle/eclipse-cs/blob/3522eb691c7c1ad230900c6c26754783121d5154/pom.xml#L118-L120

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                      <phase>verify</phase>
                      <goals>
                        <goal>exec</goal>
                      </goals>
                    </execution>
                </executions>
                <configuration>
                    <executable>git</executable>
                    <arguments>
                      <argument>diff</argument>
                      <argument>HEAD~1</argument>
                      <argument>HEAD</argument>
                    </arguments>
                    <outputFile>${maven.multiModuleProjectDirectory}/show.patch</outputFile>
                </configuration>
            </plugin>

checkstyle config:
https://github.com/checkstyle/eclipse-cs/blob/2cb3fb24be136882706b2dd4edd75ed31f9d6dae/config/checkstyle_sevntu_checks.xml#L15-L24

  <module name="com.puppycrawl.tools.checkstyle.filters.SuppressionPatchFilter">
    <property name="file" value="show.patch"/>
    <property name="strategy" value="patchedline" />
  </module>

  <module name="TreeWalker">
    <module name="com.puppycrawl.tools.checkstyle.filters.SuppressionJavaPatchFilter">
      <property name="file" value="show.patch"/>
      <property name="strategy" value="patchedline" />
    </module>

We need to find a way to generate patch file in same way as it is done by Travis to show whole code change diff in Pull Request or last changes. As not all in world use Travis, all other CIs does not make merge commit.


Without this smart patch generation there is gap in Patch filter to let uses put meaningless commit on top to hide all violations from previous commits.
But in the same time it helps to bypass situations with avalanche of checkstyle violations (fix one violation, trigger changes in other lines, fixing them, another line affected, new violations, ......) and merge with failures in CI and have green build after merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant