You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Daniel Watford <da...@foomoo.co.uk> on 2020/02/28 09:07:43 UTC

Checkstyle error: Files does not end with newline

Hello,

In my dev environment (Windows 10, IntelliJ, Git checking out with LF line
endings) I see 39 checkstyle errors for our tests related to java files not
ending with a newline.

However on inspecting one of the files, ModelFormFieldTest, I can see that
it does end with a newline.

A quick google on the subject turned up
https://stackoverflow.com/questions/997021/how-to-get-rid-of-checkstyle-message-file-does-not-end-with-a-newline
.

It appears that checkstyle will assume the line endings of the environment
where it is being run. In my case, Windows, it will assume line endings of
CRLF, rather than the LF that I am using.

If I modify the checkstyle configuration to specify LF for line endings
using:

<module name="NewlineAtEndOfFile">
    <property name="lineSeparator" value="lf" />
</module>

all the checkstyle errors in tests are resolved.

*Question: Does anyone see any issues in telling Checkstyle to use LF line
endings when it performs its checking?*

The interesting thing was that even if I convert a file to use CRLF line
endings, the above lineSeparator confgiuration for the NewlineAtEndOfFile
checkstyle module would still pass.

The above change also had the pleasant outcome of reducing checkstyle
errors for main code from 1055 files with violations to 956.

Dan

-- 
Daniel Watford

Re: Checkstyle error: Files does not end with newline

Posted by Jacques Le Roux <ja...@les7arts.com>.
Daniel,

This: https://ci.apache.org/projects/ofbiz/logs/

Jacques

Le 28/02/2020 à 14:41, Daniel Watford a écrit :
> Hi Jacques,
>
> If I follow the link to the ofbiz builds in Buildbot (
> https://ci.apache.org/builders/ofbizTrunkFramework) I can see a list of
> recent builds.
>
> How do I navigate from the list of recent builds to view the test reports -
> e.g. view build/reports/checkstyle/test.html for
> https://ci.apache.org/builders/ofbizTrunkFrameworkPlugins/builds/1202 ?
>
> Thanks,
>
> Dan.
>
> On Fri, 28 Feb 2020 at 13:28, Jacques Le Roux <ja...@les7arts.com>
> wrote:
>
>> Thanks Daniel,
>>
>> It works in Buildbot, so it's OK with me ;)
>>
>> https://ci.apache.org/builders/ofbizTrunkFramework
>>
>> Cheers
>>
>> Jacques
>>
>> Le 28/02/2020 à 11:24, Daniel Watford a écrit :
>>> Hi Jacques,
>>>
>>> I haven't been able to come up with an explanation for what you're
>> seeing,
>>> so through I'd post some of my configuration and results to see if we can
>>> spot anything odd.
>>>
>>> Building on a Windows 10 host. Executing builds from Git Bash running in
>>> Windows terminal:
>>>
>>> $ git log -1
>>> commit 66aa76d7f7fc368b5f039d0e3181edaaf85d9b27 (HEAD -> trunk,
>>> upstream/trunk, origin/trunk, origin/HEAD)
>>> Merge: cfad407c48 0ece441228
>>> Author: Jacques Le Roux <ja...@les7arts.com>
>>> Date: Fri Feb 28 09:44:28 2020 +0100
>>>
>>> Merge pull request #35 from danwatford/ofbiz-11418-documentation
>>>
>>> OFBIZ-11418: Fixed line lengths in ModelFormFieldTest to adhere to coding
>>> standards
>>>
>>> $ git status
>>> On branch trunk
>>> Your branch is up to date with 'origin/trunk'.
>>>
>>> nothing to commit, working tree clean
>>>
>>>
>>> $ ./gradlew clean
>>>
>>>> Configure project :
>>> You are using one or more deprecated Asciidoctor task or plugins. To help
>>> with migration run with --warnings=all
>>>
>>>> Task :clean
>>> BUILD SUCCESSFUL in 1s
>>> 1 actionable task: 1 executed
>>>
>>> Windows Terminal
>>> $ ./gradlew check
>>>
>>>> Configure project :
>>> You are using one or more deprecated Asciidoctor task or plugins. To help
>>> with migration run with --warnings=all
>>>
>>>> Task :compileJava
>>>> Task :compileGroovy
>>>> Task :processResources
>>>> Task :classes
>>>> Task :checkstyleMain
>>> Checkstyle rule violations were found. See the report at:
>>>
>> file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/main.html
>>> Checkstyle files with violations: 1055
>>> Checkstyle violations by severity: [error:35504]
>>>
>>>
>>>> Task :compileTestJava
>> C:\dev\clients\ActiveTransport\activate-docker-ofbiz-framework\ofbiz\framework\widget\src\test\java\org\apache\ofbiz\widget\model\ModelFormFieldTest.java:128:
>>> warning: [deprecation] getTargetParameterList() in
>>> LookupField has been deprecated
>>> assertThat(lookupField.getTargetParameterList(),
>>> Matchers.contains("${prefix}TargetParam", "${key1}"));
>>> ^
>>> 1 warning
>>>
>>>> Task :compileTestGroovy
>>>> Task :processTestResources
>>>> Task :testClasses
>>>> Task :checkstyleTest FAILED
>>> FAILURE: Build failed with an exception.
>>>
>>> * What went wrong:
>>> Execution failed for task ':checkstyleTest'.
>>>> Checkstyle rule violations were found. See the report at:
>> file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/test.html
>>> Checkstyle files with violations: 39
>>> Checkstyle violations by severity: [error:39]
>>>
>>>
>>> * Try:
>>> Run with --stacktrace option to get the stack trace. Run with --info or
>>> --debug option to get more log output. Run with --scan to get full
>> insights.
>>> * Get more help at https://help.gradle.org
>>>
>>> BUILD FAILED in 30s
>>> 8 actionable tasks: 8 executed
>>>
>>>
>>>
>>> If I then apply the change to config/checkstyle/checkstyle.xml:
>>> Index: config/checkstyle/checkstyle.xml
>>> IDEA additional info:
>>> Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
>>> <+>UTF-8
>>> ===================================================================
>>> --- config/checkstyle/checkstyle.xml (revision
>>> 66aa76d7f7fc368b5f039d0e3181edaaf85d9b27)
>>> +++ config/checkstyle/checkstyle.xml (date 1582884183549)
>>> @@ -30,7 +30,9 @@
>>>        <property name="fileExtensions" value="java, properties, xml"/>
>>>
>>>        <!-- General file conventions -->
>>> -    <module name="NewlineAtEndOfFile"/>
>>> +    <module name="NewlineAtEndOfFile">
>>> +        <property name="lineSeparator" value="lf" />
>>> +    </module>
>>>        <module name="FileTabCharacter"/>
>>>        <module name="RegexpSingleline">
>>>           <property name="format" value="\s+$"/>
>>>
>>> And re-run checkstyle:
>>> $ ./gradlew check
>>>
>>>> Configure project :
>>> You are using one or more deprecated Asciidoctor task or plugins. To help
>>> with migration run with --warnings=all
>>>
>>>> Task :compileJava UP-TO-DATE
>>>> Task :compileGroovy UP-TO-DATE
>>>> Task :processResources UP-TO-DATE
>>>> Task :classes UP-TO-DATE
>>>> Task :checkstyleMain
>>> Checkstyle rule violations were found. See the report at:
>>>
>> file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/main.html
>>> Checkstyle files with violations: 956
>>> Checkstyle violations by severity: [error:34464]
>>>
>>>
>>>> Task :compileTestJava UP-TO-DATE
>>>> Task :compileTestGroovy UP-TO-DATE
>>>> Task :processTestResources UP-TO-DATE
>>>> Task :testClasses UP-TO-DATE
>>>> Task :checkstyleTest
>>>> Task :test
>>>> Task :check
>>> BUILD SUCCESSFUL in 40s
>>> 9 actionable tasks: 3 executed, 6 up-to-date
>>>
>>>
>>>
>>> This time all the 39 test file violations have been cleared.
>>>
>>> Just in case there are some LF / CRLF issues remaining in your work area
>>> you could run something like the following (assuming you have cygwin /
>> msys
>>> / git bash)
>>> $ find . -path ./build -prune -o -not -type d -exec file "{}" ";" | grep
>>> CRLF
>>>
>>>
>>>
>>> My git config is as follows:
>>> $ git config --list --show-origin | grep -v branch.ofbiz
>>> file:C:/Program Files/Git/etc/gitconfig
>>> diff.astextplain.textconv=astextplain
>>> file:C:/Program Files/Git/etc/gitconfig filter.lfs.clean=git-lfs clean
>> -- %f
>>> file:C:/Program Files/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge
>> --
>>> %f
>>> file:C:/Program Files/Git/etc/gitconfig filter.lfs.process=git-lfs
>>> filter-process
>>> file:C:/Program Files/Git/etc/gitconfig filter.lfs.required=true
>>> file:C:/Program Files/Git/etc/gitconfig http.sslbackend=openssl
>>> file:C:/Program Files/Git/etc/gitconfig http.sslcainfo=C:/Program
>>> Files/Git/mingw64/ssl/certs/ca-bundle.crt
>>> file:C:/Program Files/Git/etc/gitconfig core.autocrlf=input
>>> file:C:/Program Files/Git/etc/gitconfig core.fscache=true
>>> file:C:/Program Files/Git/etc/gitconfig core.symlinks=false
>>> file:C:/Program Files/Git/etc/gitconfig credential.helper=manager
>>> file:C:/Users/DanielWatford/.gitconfig user.name=Daniel Watford
>>> file:C:/Users/DanielWatford/.gitconfig user.email=
>>> daniel@watfordconsulting.com
>>> file:C:/Users/DanielWatford/.gitconfig
>>> commit.template=C:/Users/DanielWatford/.gitmessage
>>> file:.git/config core.repositoryformatversion=0
>>> file:.git/config core.filemode=false
>>> file:.git/config core.bare=false
>>> file:.git/config core.logallrefupdates=true
>>> file:.git/config core.symlinks=false
>>> file:.git/config core.ignorecase=true
>>> file:.git/config remote.origin.url=
>>> https://github.com/danwatford/ofbiz-framework
>>> file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
>>> file:.git/config branch.trunk.remote=origin
>>> file:.git/config branch.trunk.merge=refs/heads/trunk
>>> file:.git/config branch.release18.12.remote=origin
>>> file:.git/config branch.release18.12.merge=refs/heads/release18.12
>>> file:.git/config remote.upstream.url=
>>> https://github.com/apache/ofbiz-framework
>>> file:.git/config
>> remote.upstream.fetch=+refs/heads/*:refs/remotes/upstream/*
>>>
>>> Hopefully there might be some differences we can look into.
>>>
>>> Hope that helps,
>>>
>>> Dan.
>>>
>>> On Fri, 28 Feb 2020 at 09:34, Jacques Le Roux <
>> jacques.le.roux@les7arts.com>
>>> wrote:
>>>
>>>> Le 28/02/2020 à 10:22, Jacques Le Roux a écrit :
>>>>> Le 28/02/2020 à 10:07, Daniel Watford a écrit :
>>>>>> Hello,
>>>>>>
>>>>>> In my dev environment (Windows 10, IntelliJ, Git checking out with LF
>>>> line
>>>>>> endings) I see 39 checkstyle errors for our tests related to java
>> files
>>>> not
>>>>>> ending with a newline.
>>>>>>
>>>>>> However on inspecting one of the files, ModelFormFieldTest, I can see
>>>> that
>>>>>> it does end with a newline.
>>>>>>
>>>>>> A quick google on the subject turned up
>>>>>>
>> https://stackoverflow.com/questions/997021/how-to-get-rid-of-checkstyle-message-file-does-not-end-with-a-newline
>>>>>> .
>>>>>>
>>>>>> It appears that checkstyle will assume the line endings of the
>>>> environment
>>>>>> where it is being run. In my case, Windows, it will assume line
>> endings
>>>> of
>>>>>> CRLF, rather than the LF that I am using.
>>>>>>
>>>>>> If I modify the checkstyle configuration to specify LF for line
>> endings
>>>>>> using:
>>>>>>
>>>>>> <module name="NewlineAtEndOfFile">
>>>>>>        <property name="lineSeparator" value="lf" />
>>>>>> </module>
>>>>>>
>>>>>> all the checkstyle errors in tests are resolved.
>>>>>>
>>>>>> *Question: Does anyone see any issues in telling Checkstyle to use LF
>>>> line
>>>>>> endings when it performs its checking?*
>>>>>>
>>>>>> The interesting thing was that even if I convert a file to use CRLF
>> line
>>>>>> endings, the above lineSeparator confgiuration for the
>>>> NewlineAtEndOfFile
>>>>>> checkstyle module would still pass.
>>>>>>
>>>>>> The above change also had the pleasant outcome of reducing checkstyle
>>>>>> errors for main code from 1055 files with violations to 956.
>>>>>>
>>>>>> Dan
>>>>> Hi Daniel,
>>>>>
>>>>> Thanks for this information, I use also Windows (7) and was just to the
>>>> point to look at the remaning issue with checkstyle.
>>>>> +1 for your proposition
>>>>>
>>>>> But I just tried after changing NewlineAtEndOfFile module as you
>>>> suggest, and got this
>>>>>      /C:\projectsASF\Git\ofbiz-framework>gradlew check > Configure
>> project
>>>> : You are using one or more deprecated Asciidoctor task or plugins. To
>> help
>>>>>      with migration run with --warnings=all > Task :compileJava
>> UP-TO-DATE
>>>>> Task :compileGroovy UP-TO-DATE > Task :processResources UP-TO-DATE >
>> Task
>>>>>      :classes UP-TO-DATE > Task :checkstyleMain Checkstyle rule
>> violations
>>>> were found. See the report at:
>>>>
>> file:///C:/projectsASF/Git/ofbiz-framework/build/reports/checkstyle/main.html
>>>> Checkstyle files with violations: 1038 Checkstyle violations by
>>>>>      severity: [error:37692] > Task :compileTestJava UP-TO-DATE > Task
>>>> :compileTestGroovy UP-TO-DATE > Task :processTestResources UP-TO-DATE >
>> Task
>>>>>      :testClasses UP-TO-DATE > Task :checkstyleTest > Task :test FAILED
>>>> FAILURE: Build failed with an exception. * What went wrong: Execution
>> failed
>>>>>      for task ':test'. > 120/
>>>>>
>>>>> Don't you have any checkstyle issues with trunk HEAD?
>>>>> I checked my Git local config and see no reasons, any ideas?
>>>>>
>>>>> Jacques
>>>>>
>>>> Also using
>>>>
>>>>       /    <module name="NewlineAtEndOfFile">//
>>>>       //        <property name="severity" value="ignore" />//
>>>>       //    </module>/
>>>>
>>>> Does not help, weird, isn't?
>>>>
>>>> I'll relaunch manually
>>>> https://ci.apache.org/builders/ofbizTrunkFramework/builds/1296
>>>>
>>>> Because https://ci.apache.org/projects/ofbiz/logs/trunk/framework/html/
>>>> makes no sense another Buildbot quirk ;)
>>>>
>>>> Jacques
>>>>
>>>>
>

Re: Checkstyle error: Files does not end with newline

Posted by Daniel Watford <da...@foomoo.co.uk>.
Hi Jacques,

If I follow the link to the ofbiz builds in Buildbot (
https://ci.apache.org/builders/ofbizTrunkFramework) I can see a list of
recent builds.

How do I navigate from the list of recent builds to view the test reports -
e.g. view build/reports/checkstyle/test.html for
https://ci.apache.org/builders/ofbizTrunkFrameworkPlugins/builds/1202 ?

Thanks,

Dan.

On Fri, 28 Feb 2020 at 13:28, Jacques Le Roux <ja...@les7arts.com>
wrote:

> Thanks Daniel,
>
> It works in Buildbot, so it's OK with me ;)
>
> https://ci.apache.org/builders/ofbizTrunkFramework
>
> Cheers
>
> Jacques
>
> Le 28/02/2020 à 11:24, Daniel Watford a écrit :
> > Hi Jacques,
> >
> > I haven't been able to come up with an explanation for what you're
> seeing,
> > so through I'd post some of my configuration and results to see if we can
> > spot anything odd.
> >
> > Building on a Windows 10 host. Executing builds from Git Bash running in
> > Windows terminal:
> >
> > $ git log -1
> > commit 66aa76d7f7fc368b5f039d0e3181edaaf85d9b27 (HEAD -> trunk,
> > upstream/trunk, origin/trunk, origin/HEAD)
> > Merge: cfad407c48 0ece441228
> > Author: Jacques Le Roux <ja...@les7arts.com>
> > Date: Fri Feb 28 09:44:28 2020 +0100
> >
> > Merge pull request #35 from danwatford/ofbiz-11418-documentation
> >
> > OFBIZ-11418: Fixed line lengths in ModelFormFieldTest to adhere to coding
> > standards
> >
> > $ git status
> > On branch trunk
> > Your branch is up to date with 'origin/trunk'.
> >
> > nothing to commit, working tree clean
> >
> >
> > $ ./gradlew clean
> >
> >> Configure project :
> > You are using one or more deprecated Asciidoctor task or plugins. To help
> > with migration run with --warnings=all
> >
> >> Task :clean
> > BUILD SUCCESSFUL in 1s
> > 1 actionable task: 1 executed
> >
> > Windows Terminal
> > $ ./gradlew check
> >
> >> Configure project :
> > You are using one or more deprecated Asciidoctor task or plugins. To help
> > with migration run with --warnings=all
> >
> >> Task :compileJava
> >> Task :compileGroovy
> >> Task :processResources
> >> Task :classes
> >> Task :checkstyleMain
> > Checkstyle rule violations were found. See the report at:
> >
> file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/main.html
> > Checkstyle files with violations: 1055
> > Checkstyle violations by severity: [error:35504]
> >
> >
> >> Task :compileTestJava
> >
> C:\dev\clients\ActiveTransport\activate-docker-ofbiz-framework\ofbiz\framework\widget\src\test\java\org\apache\ofbiz\widget\model\ModelFormFieldTest.java:128:
> > warning: [deprecation] getTargetParameterList() in
> > LookupField has been deprecated
> > assertThat(lookupField.getTargetParameterList(),
> > Matchers.contains("${prefix}TargetParam", "${key1}"));
> > ^
> > 1 warning
> >
> >> Task :compileTestGroovy
> >> Task :processTestResources
> >> Task :testClasses
> >> Task :checkstyleTest FAILED
> > FAILURE: Build failed with an exception.
> >
> > * What went wrong:
> > Execution failed for task ':checkstyleTest'.
> >> Checkstyle rule violations were found. See the report at:
> >
> file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/test.html
> > Checkstyle files with violations: 39
> > Checkstyle violations by severity: [error:39]
> >
> >
> > * Try:
> > Run with --stacktrace option to get the stack trace. Run with --info or
> > --debug option to get more log output. Run with --scan to get full
> insights.
> >
> > * Get more help at https://help.gradle.org
> >
> > BUILD FAILED in 30s
> > 8 actionable tasks: 8 executed
> >
> >
> >
> > If I then apply the change to config/checkstyle/checkstyle.xml:
> > Index: config/checkstyle/checkstyle.xml
> > IDEA additional info:
> > Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
> > <+>UTF-8
> > ===================================================================
> > --- config/checkstyle/checkstyle.xml (revision
> > 66aa76d7f7fc368b5f039d0e3181edaaf85d9b27)
> > +++ config/checkstyle/checkstyle.xml (date 1582884183549)
> > @@ -30,7 +30,9 @@
> >       <property name="fileExtensions" value="java, properties, xml"/>
> >
> >       <!-- General file conventions -->
> > -    <module name="NewlineAtEndOfFile"/>
> > +    <module name="NewlineAtEndOfFile">
> > +        <property name="lineSeparator" value="lf" />
> > +    </module>
> >       <module name="FileTabCharacter"/>
> >       <module name="RegexpSingleline">
> >          <property name="format" value="\s+$"/>
> >
> > And re-run checkstyle:
> > $ ./gradlew check
> >
> >> Configure project :
> > You are using one or more deprecated Asciidoctor task or plugins. To help
> > with migration run with --warnings=all
> >
> >> Task :compileJava UP-TO-DATE
> >> Task :compileGroovy UP-TO-DATE
> >> Task :processResources UP-TO-DATE
> >> Task :classes UP-TO-DATE
> >> Task :checkstyleMain
> > Checkstyle rule violations were found. See the report at:
> >
> file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/main.html
> > Checkstyle files with violations: 956
> > Checkstyle violations by severity: [error:34464]
> >
> >
> >> Task :compileTestJava UP-TO-DATE
> >> Task :compileTestGroovy UP-TO-DATE
> >> Task :processTestResources UP-TO-DATE
> >> Task :testClasses UP-TO-DATE
> >> Task :checkstyleTest
> >> Task :test
> >> Task :check
> > BUILD SUCCESSFUL in 40s
> > 9 actionable tasks: 3 executed, 6 up-to-date
> >
> >
> >
> > This time all the 39 test file violations have been cleared.
> >
> > Just in case there are some LF / CRLF issues remaining in your work area
> > you could run something like the following (assuming you have cygwin /
> msys
> > / git bash)
> > $ find . -path ./build -prune -o -not -type d -exec file "{}" ";" | grep
> > CRLF
> >
> >
> >
> > My git config is as follows:
> > $ git config --list --show-origin | grep -v branch.ofbiz
> > file:C:/Program Files/Git/etc/gitconfig
> > diff.astextplain.textconv=astextplain
> > file:C:/Program Files/Git/etc/gitconfig filter.lfs.clean=git-lfs clean
> -- %f
> > file:C:/Program Files/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge
> --
> > %f
> > file:C:/Program Files/Git/etc/gitconfig filter.lfs.process=git-lfs
> > filter-process
> > file:C:/Program Files/Git/etc/gitconfig filter.lfs.required=true
> > file:C:/Program Files/Git/etc/gitconfig http.sslbackend=openssl
> > file:C:/Program Files/Git/etc/gitconfig http.sslcainfo=C:/Program
> > Files/Git/mingw64/ssl/certs/ca-bundle.crt
> > file:C:/Program Files/Git/etc/gitconfig core.autocrlf=input
> > file:C:/Program Files/Git/etc/gitconfig core.fscache=true
> > file:C:/Program Files/Git/etc/gitconfig core.symlinks=false
> > file:C:/Program Files/Git/etc/gitconfig credential.helper=manager
> > file:C:/Users/DanielWatford/.gitconfig user.name=Daniel Watford
> > file:C:/Users/DanielWatford/.gitconfig user.email=
> > daniel@watfordconsulting.com
> > file:C:/Users/DanielWatford/.gitconfig
> > commit.template=C:/Users/DanielWatford/.gitmessage
> > file:.git/config core.repositoryformatversion=0
> > file:.git/config core.filemode=false
> > file:.git/config core.bare=false
> > file:.git/config core.logallrefupdates=true
> > file:.git/config core.symlinks=false
> > file:.git/config core.ignorecase=true
> > file:.git/config remote.origin.url=
> > https://github.com/danwatford/ofbiz-framework
> > file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
> > file:.git/config branch.trunk.remote=origin
> > file:.git/config branch.trunk.merge=refs/heads/trunk
> > file:.git/config branch.release18.12.remote=origin
> > file:.git/config branch.release18.12.merge=refs/heads/release18.12
> > file:.git/config remote.upstream.url=
> > https://github.com/apache/ofbiz-framework
> > file:.git/config
> remote.upstream.fetch=+refs/heads/*:refs/remotes/upstream/*
> >
> >
> > Hopefully there might be some differences we can look into.
> >
> > Hope that helps,
> >
> > Dan.
> >
> > On Fri, 28 Feb 2020 at 09:34, Jacques Le Roux <
> jacques.le.roux@les7arts.com>
> > wrote:
> >
> >> Le 28/02/2020 à 10:22, Jacques Le Roux a écrit :
> >>> Le 28/02/2020 à 10:07, Daniel Watford a écrit :
> >>>> Hello,
> >>>>
> >>>> In my dev environment (Windows 10, IntelliJ, Git checking out with LF
> >> line
> >>>> endings) I see 39 checkstyle errors for our tests related to java
> files
> >> not
> >>>> ending with a newline.
> >>>>
> >>>> However on inspecting one of the files, ModelFormFieldTest, I can see
> >> that
> >>>> it does end with a newline.
> >>>>
> >>>> A quick google on the subject turned up
> >>>>
> >>
> https://stackoverflow.com/questions/997021/how-to-get-rid-of-checkstyle-message-file-does-not-end-with-a-newline
> >>>> .
> >>>>
> >>>> It appears that checkstyle will assume the line endings of the
> >> environment
> >>>> where it is being run. In my case, Windows, it will assume line
> endings
> >> of
> >>>> CRLF, rather than the LF that I am using.
> >>>>
> >>>> If I modify the checkstyle configuration to specify LF for line
> endings
> >>>> using:
> >>>>
> >>>> <module name="NewlineAtEndOfFile">
> >>>>       <property name="lineSeparator" value="lf" />
> >>>> </module>
> >>>>
> >>>> all the checkstyle errors in tests are resolved.
> >>>>
> >>>> *Question: Does anyone see any issues in telling Checkstyle to use LF
> >> line
> >>>> endings when it performs its checking?*
> >>>>
> >>>> The interesting thing was that even if I convert a file to use CRLF
> line
> >>>> endings, the above lineSeparator confgiuration for the
> >> NewlineAtEndOfFile
> >>>> checkstyle module would still pass.
> >>>>
> >>>> The above change also had the pleasant outcome of reducing checkstyle
> >>>> errors for main code from 1055 files with violations to 956.
> >>>>
> >>>> Dan
> >>> Hi Daniel,
> >>>
> >>> Thanks for this information, I use also Windows (7) and was just to the
> >> point to look at the remaning issue with checkstyle.
> >>> +1 for your proposition
> >>>
> >>> But I just tried after changing NewlineAtEndOfFile module as you
> >> suggest, and got this
> >>>     /C:\projectsASF\Git\ofbiz-framework>gradlew check > Configure
> project
> >> : You are using one or more deprecated Asciidoctor task or plugins. To
> help
> >>>     with migration run with --warnings=all > Task :compileJava
> UP-TO-DATE
> >>> Task :compileGroovy UP-TO-DATE > Task :processResources UP-TO-DATE >
> Task
> >>>     :classes UP-TO-DATE > Task :checkstyleMain Checkstyle rule
> violations
> >> were found. See the report at:
> >>
> file:///C:/projectsASF/Git/ofbiz-framework/build/reports/checkstyle/main.html
> >> Checkstyle files with violations: 1038 Checkstyle violations by
> >>>     severity: [error:37692] > Task :compileTestJava UP-TO-DATE > Task
> >> :compileTestGroovy UP-TO-DATE > Task :processTestResources UP-TO-DATE >
> Task
> >>>     :testClasses UP-TO-DATE > Task :checkstyleTest > Task :test FAILED
> >> FAILURE: Build failed with an exception. * What went wrong: Execution
> failed
> >>>     for task ':test'. > 120/
> >>>
> >>> Don't you have any checkstyle issues with trunk HEAD?
> >>> I checked my Git local config and see no reasons, any ideas?
> >>>
> >>> Jacques
> >>>
> >> Also using
> >>
> >>      /    <module name="NewlineAtEndOfFile">//
> >>      //        <property name="severity" value="ignore" />//
> >>      //    </module>/
> >>
> >> Does not help, weird, isn't?
> >>
> >> I'll relaunch manually
> >> https://ci.apache.org/builders/ofbizTrunkFramework/builds/1296
> >>
> >> Because https://ci.apache.org/projects/ofbiz/logs/trunk/framework/html/
> >> makes no sense another Buildbot quirk ;)
> >>
> >> Jacques
> >>
> >>
>


-- 
Daniel Watford

Re: Checkstyle error: Files does not end with newline

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks Daniel,

It works in Buildbot, so it's OK with me ;)

https://ci.apache.org/builders/ofbizTrunkFramework

Cheers

Jacques

Le 28/02/2020 à 11:24, Daniel Watford a écrit :
> Hi Jacques,
>
> I haven't been able to come up with an explanation for what you're seeing,
> so through I'd post some of my configuration and results to see if we can
> spot anything odd.
>
> Building on a Windows 10 host. Executing builds from Git Bash running in
> Windows terminal:
>
> $ git log -1
> commit 66aa76d7f7fc368b5f039d0e3181edaaf85d9b27 (HEAD -> trunk,
> upstream/trunk, origin/trunk, origin/HEAD)
> Merge: cfad407c48 0ece441228
> Author: Jacques Le Roux <ja...@les7arts.com>
> Date: Fri Feb 28 09:44:28 2020 +0100
>
> Merge pull request #35 from danwatford/ofbiz-11418-documentation
>
> OFBIZ-11418: Fixed line lengths in ModelFormFieldTest to adhere to coding
> standards
>
> $ git status
> On branch trunk
> Your branch is up to date with 'origin/trunk'.
>
> nothing to commit, working tree clean
>
>
> $ ./gradlew clean
>
>> Configure project :
> You are using one or more deprecated Asciidoctor task or plugins. To help
> with migration run with --warnings=all
>
>> Task :clean
> BUILD SUCCESSFUL in 1s
> 1 actionable task: 1 executed
>
> Windows Terminal
> $ ./gradlew check
>
>> Configure project :
> You are using one or more deprecated Asciidoctor task or plugins. To help
> with migration run with --warnings=all
>
>> Task :compileJava
>> Task :compileGroovy
>> Task :processResources
>> Task :classes
>> Task :checkstyleMain
> Checkstyle rule violations were found. See the report at:
> file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/main.html
> Checkstyle files with violations: 1055
> Checkstyle violations by severity: [error:35504]
>
>
>> Task :compileTestJava
> C:\dev\clients\ActiveTransport\activate-docker-ofbiz-framework\ofbiz\framework\widget\src\test\java\org\apache\ofbiz\widget\model\ModelFormFieldTest.java:128:
> warning: [deprecation] getTargetParameterList() in
> LookupField has been deprecated
> assertThat(lookupField.getTargetParameterList(),
> Matchers.contains("${prefix}TargetParam", "${key1}"));
> ^
> 1 warning
>
>> Task :compileTestGroovy
>> Task :processTestResources
>> Task :testClasses
>> Task :checkstyleTest FAILED
> FAILURE: Build failed with an exception.
>
> * What went wrong:
> Execution failed for task ':checkstyleTest'.
>> Checkstyle rule violations were found. See the report at:
> file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/test.html
> Checkstyle files with violations: 39
> Checkstyle violations by severity: [error:39]
>
>
> * Try:
> Run with --stacktrace option to get the stack trace. Run with --info or
> --debug option to get more log output. Run with --scan to get full insights.
>
> * Get more help at https://help.gradle.org
>
> BUILD FAILED in 30s
> 8 actionable tasks: 8 executed
>
>
>
> If I then apply the change to config/checkstyle/checkstyle.xml:
> Index: config/checkstyle/checkstyle.xml
> IDEA additional info:
> Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
> <+>UTF-8
> ===================================================================
> --- config/checkstyle/checkstyle.xml (revision
> 66aa76d7f7fc368b5f039d0e3181edaaf85d9b27)
> +++ config/checkstyle/checkstyle.xml (date 1582884183549)
> @@ -30,7 +30,9 @@
>       <property name="fileExtensions" value="java, properties, xml"/>
>
>       <!-- General file conventions -->
> -    <module name="NewlineAtEndOfFile"/>
> +    <module name="NewlineAtEndOfFile">
> +        <property name="lineSeparator" value="lf" />
> +    </module>
>       <module name="FileTabCharacter"/>
>       <module name="RegexpSingleline">
>          <property name="format" value="\s+$"/>
>
> And re-run checkstyle:
> $ ./gradlew check
>
>> Configure project :
> You are using one or more deprecated Asciidoctor task or plugins. To help
> with migration run with --warnings=all
>
>> Task :compileJava UP-TO-DATE
>> Task :compileGroovy UP-TO-DATE
>> Task :processResources UP-TO-DATE
>> Task :classes UP-TO-DATE
>> Task :checkstyleMain
> Checkstyle rule violations were found. See the report at:
> file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/main.html
> Checkstyle files with violations: 956
> Checkstyle violations by severity: [error:34464]
>
>
>> Task :compileTestJava UP-TO-DATE
>> Task :compileTestGroovy UP-TO-DATE
>> Task :processTestResources UP-TO-DATE
>> Task :testClasses UP-TO-DATE
>> Task :checkstyleTest
>> Task :test
>> Task :check
> BUILD SUCCESSFUL in 40s
> 9 actionable tasks: 3 executed, 6 up-to-date
>
>
>
> This time all the 39 test file violations have been cleared.
>
> Just in case there are some LF / CRLF issues remaining in your work area
> you could run something like the following (assuming you have cygwin / msys
> / git bash)
> $ find . -path ./build -prune -o -not -type d -exec file "{}" ";" | grep
> CRLF
>
>
>
> My git config is as follows:
> $ git config --list --show-origin | grep -v branch.ofbiz
> file:C:/Program Files/Git/etc/gitconfig
> diff.astextplain.textconv=astextplain
> file:C:/Program Files/Git/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f
> file:C:/Program Files/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge --
> %f
> file:C:/Program Files/Git/etc/gitconfig filter.lfs.process=git-lfs
> filter-process
> file:C:/Program Files/Git/etc/gitconfig filter.lfs.required=true
> file:C:/Program Files/Git/etc/gitconfig http.sslbackend=openssl
> file:C:/Program Files/Git/etc/gitconfig http.sslcainfo=C:/Program
> Files/Git/mingw64/ssl/certs/ca-bundle.crt
> file:C:/Program Files/Git/etc/gitconfig core.autocrlf=input
> file:C:/Program Files/Git/etc/gitconfig core.fscache=true
> file:C:/Program Files/Git/etc/gitconfig core.symlinks=false
> file:C:/Program Files/Git/etc/gitconfig credential.helper=manager
> file:C:/Users/DanielWatford/.gitconfig user.name=Daniel Watford
> file:C:/Users/DanielWatford/.gitconfig user.email=
> daniel@watfordconsulting.com
> file:C:/Users/DanielWatford/.gitconfig
> commit.template=C:/Users/DanielWatford/.gitmessage
> file:.git/config core.repositoryformatversion=0
> file:.git/config core.filemode=false
> file:.git/config core.bare=false
> file:.git/config core.logallrefupdates=true
> file:.git/config core.symlinks=false
> file:.git/config core.ignorecase=true
> file:.git/config remote.origin.url=
> https://github.com/danwatford/ofbiz-framework
> file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
> file:.git/config branch.trunk.remote=origin
> file:.git/config branch.trunk.merge=refs/heads/trunk
> file:.git/config branch.release18.12.remote=origin
> file:.git/config branch.release18.12.merge=refs/heads/release18.12
> file:.git/config remote.upstream.url=
> https://github.com/apache/ofbiz-framework
> file:.git/config remote.upstream.fetch=+refs/heads/*:refs/remotes/upstream/*
>
>
> Hopefully there might be some differences we can look into.
>
> Hope that helps,
>
> Dan.
>
> On Fri, 28 Feb 2020 at 09:34, Jacques Le Roux <ja...@les7arts.com>
> wrote:
>
>> Le 28/02/2020 à 10:22, Jacques Le Roux a écrit :
>>> Le 28/02/2020 à 10:07, Daniel Watford a écrit :
>>>> Hello,
>>>>
>>>> In my dev environment (Windows 10, IntelliJ, Git checking out with LF
>> line
>>>> endings) I see 39 checkstyle errors for our tests related to java files
>> not
>>>> ending with a newline.
>>>>
>>>> However on inspecting one of the files, ModelFormFieldTest, I can see
>> that
>>>> it does end with a newline.
>>>>
>>>> A quick google on the subject turned up
>>>>
>> https://stackoverflow.com/questions/997021/how-to-get-rid-of-checkstyle-message-file-does-not-end-with-a-newline
>>>> .
>>>>
>>>> It appears that checkstyle will assume the line endings of the
>> environment
>>>> where it is being run. In my case, Windows, it will assume line endings
>> of
>>>> CRLF, rather than the LF that I am using.
>>>>
>>>> If I modify the checkstyle configuration to specify LF for line endings
>>>> using:
>>>>
>>>> <module name="NewlineAtEndOfFile">
>>>>       <property name="lineSeparator" value="lf" />
>>>> </module>
>>>>
>>>> all the checkstyle errors in tests are resolved.
>>>>
>>>> *Question: Does anyone see any issues in telling Checkstyle to use LF
>> line
>>>> endings when it performs its checking?*
>>>>
>>>> The interesting thing was that even if I convert a file to use CRLF line
>>>> endings, the above lineSeparator confgiuration for the
>> NewlineAtEndOfFile
>>>> checkstyle module would still pass.
>>>>
>>>> The above change also had the pleasant outcome of reducing checkstyle
>>>> errors for main code from 1055 files with violations to 956.
>>>>
>>>> Dan
>>> Hi Daniel,
>>>
>>> Thanks for this information, I use also Windows (7) and was just to the
>> point to look at the remaning issue with checkstyle.
>>> +1 for your proposition
>>>
>>> But I just tried after changing NewlineAtEndOfFile module as you
>> suggest, and got this
>>>     /C:\projectsASF\Git\ofbiz-framework>gradlew check > Configure project
>> : You are using one or more deprecated Asciidoctor task or plugins. To help
>>>     with migration run with --warnings=all > Task :compileJava UP-TO-DATE
>>> Task :compileGroovy UP-TO-DATE > Task :processResources UP-TO-DATE > Task
>>>     :classes UP-TO-DATE > Task :checkstyleMain Checkstyle rule violations
>> were found. See the report at:
>> file:///C:/projectsASF/Git/ofbiz-framework/build/reports/checkstyle/main.html
>> Checkstyle files with violations: 1038 Checkstyle violations by
>>>     severity: [error:37692] > Task :compileTestJava UP-TO-DATE > Task
>> :compileTestGroovy UP-TO-DATE > Task :processTestResources UP-TO-DATE > Task
>>>     :testClasses UP-TO-DATE > Task :checkstyleTest > Task :test FAILED
>> FAILURE: Build failed with an exception. * What went wrong: Execution failed
>>>     for task ':test'. > 120/
>>>
>>> Don't you have any checkstyle issues with trunk HEAD?
>>> I checked my Git local config and see no reasons, any ideas?
>>>
>>> Jacques
>>>
>> Also using
>>
>>      /    <module name="NewlineAtEndOfFile">//
>>      //        <property name="severity" value="ignore" />//
>>      //    </module>/
>>
>> Does not help, weird, isn't?
>>
>> I'll relaunch manually
>> https://ci.apache.org/builders/ofbizTrunkFramework/builds/1296
>>
>> Because https://ci.apache.org/projects/ofbiz/logs/trunk/framework/html/
>> makes no sense another Buildbot quirk ;)
>>
>> Jacques
>>
>>

Re: Checkstyle error: Files does not end with newline

Posted by Daniel Watford <da...@foomoo.co.uk>.
Issue  https://issues.apache.org/jira/browse/OFBIZ-11428 raised and PR
https://github.com/apache/ofbiz-framework/pull/36  created

On Fri, 28 Feb 2020 at 10:24, Daniel Watford <da...@foomoo.co.uk> wrote:

> Hi Jacques,
>
> I haven't been able to come up with an explanation for what you're seeing,
> so through I'd post some of my configuration and results to see if we can
> spot anything odd.
>
> Building on a Windows 10 host. Executing builds from Git Bash running in
> Windows terminal:
>
> $ git log -1
> commit 66aa76d7f7fc368b5f039d0e3181edaaf85d9b27 (HEAD -> trunk,
> upstream/trunk, origin/trunk, origin/HEAD)
> Merge: cfad407c48 0ece441228
> Author: Jacques Le Roux <ja...@les7arts.com>
> Date: Fri Feb 28 09:44:28 2020 +0100
>
> Merge pull request #35 from danwatford/ofbiz-11418-documentation
>
> OFBIZ-11418: Fixed line lengths in ModelFormFieldTest to adhere to coding
> standards
>
> $ git status
> On branch trunk
> Your branch is up to date with 'origin/trunk'.
>
> nothing to commit, working tree clean
>
>
> $ ./gradlew clean
>
> > Configure project :
> You are using one or more deprecated Asciidoctor task or plugins. To help
> with migration run with --warnings=all
>
> > Task :clean
>
> BUILD SUCCESSFUL in 1s
> 1 actionable task: 1 executed
>
> Windows Terminal
> $ ./gradlew check
>
> > Configure project :
> You are using one or more deprecated Asciidoctor task or plugins. To help
> with migration run with --warnings=all
>
> > Task :compileJava
> > Task :compileGroovy
> > Task :processResources
> > Task :classes
>
> > Task :checkstyleMain
> Checkstyle rule violations were found. See the report at:
> file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/main.html
> Checkstyle files with violations: 1055
> Checkstyle violations by severity: [error:35504]
>
>
> > Task :compileTestJava
> C:\dev\clients\ActiveTransport\activate-docker-ofbiz-framework\ofbiz\framework\widget\src\test\java\org\apache\ofbiz\widget\model\ModelFormFieldTest.java:128:
> warning: [deprecation] getTargetParameterList() in
> LookupField has been deprecated
> assertThat(lookupField.getTargetParameterList(),
> Matchers.contains("${prefix}TargetParam", "${key1}"));
> ^
> 1 warning
>
> > Task :compileTestGroovy
> > Task :processTestResources
> > Task :testClasses
> > Task :checkstyleTest FAILED
>
> FAILURE: Build failed with an exception.
>
> * What went wrong:
> Execution failed for task ':checkstyleTest'.
> > Checkstyle rule violations were found. See the report at:
> file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/test.html
> Checkstyle files with violations: 39
> Checkstyle violations by severity: [error:39]
>
>
> * Try:
> Run with --stacktrace option to get the stack trace. Run with --info or
> --debug option to get more log output. Run with --scan to get full insights.
>
> * Get more help at https://help.gradle.org
>
> BUILD FAILED in 30s
> 8 actionable tasks: 8 executed
>
>
>
> If I then apply the change to config/checkstyle/checkstyle.xml:
> Index: config/checkstyle/checkstyle.xml
> IDEA additional info:
> Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
> <+>UTF-8
> ===================================================================
> --- config/checkstyle/checkstyle.xml (revision
> 66aa76d7f7fc368b5f039d0e3181edaaf85d9b27)
> +++ config/checkstyle/checkstyle.xml (date 1582884183549)
> @@ -30,7 +30,9 @@
>      <property name="fileExtensions" value="java, properties, xml"/>
>
>      <!-- General file conventions -->
> -    <module name="NewlineAtEndOfFile"/>
> +    <module name="NewlineAtEndOfFile">
> +        <property name="lineSeparator" value="lf" />
> +    </module>
>      <module name="FileTabCharacter"/>
>      <module name="RegexpSingleline">
>         <property name="format" value="\s+$"/>
>
> And re-run checkstyle:
> $ ./gradlew check
>
> > Configure project :
> You are using one or more deprecated Asciidoctor task or plugins. To help
> with migration run with --warnings=all
>
> > Task :compileJava UP-TO-DATE
> > Task :compileGroovy UP-TO-DATE
> > Task :processResources UP-TO-DATE
> > Task :classes UP-TO-DATE
>
> > Task :checkstyleMain
> Checkstyle rule violations were found. See the report at:
> file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/main.html
> Checkstyle files with violations: 956
> Checkstyle violations by severity: [error:34464]
>
>
> > Task :compileTestJava UP-TO-DATE
> > Task :compileTestGroovy UP-TO-DATE
> > Task :processTestResources UP-TO-DATE
> > Task :testClasses UP-TO-DATE
> > Task :checkstyleTest
> > Task :test
> > Task :check
>
> BUILD SUCCESSFUL in 40s
> 9 actionable tasks: 3 executed, 6 up-to-date
>
>
>
> This time all the 39 test file violations have been cleared.
>
> Just in case there are some LF / CRLF issues remaining in your work area
> you could run something like the following (assuming you have cygwin / msys
> / git bash)
> $ find . -path ./build -prune -o -not -type d -exec file "{}" ";" | grep
> CRLF
>
>
>
> My git config is as follows:
> $ git config --list --show-origin | grep -v branch.ofbiz
> file:C:/Program Files/Git/etc/gitconfig
> diff.astextplain.textconv=astextplain
> file:C:/Program Files/Git/etc/gitconfig filter.lfs.clean=git-lfs clean --
> %f
> file:C:/Program Files/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge
> -- %f
> file:C:/Program Files/Git/etc/gitconfig filter.lfs.process=git-lfs
> filter-process
> file:C:/Program Files/Git/etc/gitconfig filter.lfs.required=true
> file:C:/Program Files/Git/etc/gitconfig http.sslbackend=openssl
> file:C:/Program Files/Git/etc/gitconfig http.sslcainfo=C:/Program
> Files/Git/mingw64/ssl/certs/ca-bundle.crt
> file:C:/Program Files/Git/etc/gitconfig core.autocrlf=input
> file:C:/Program Files/Git/etc/gitconfig core.fscache=true
> file:C:/Program Files/Git/etc/gitconfig core.symlinks=false
> file:C:/Program Files/Git/etc/gitconfig credential.helper=manager
> file:C:/Users/DanielWatford/.gitconfig user.name=Daniel Watford
> file:C:/Users/DanielWatford/.gitconfig user.email=
> daniel@watfordconsulting.com
> file:C:/Users/DanielWatford/.gitconfig
> commit.template=C:/Users/DanielWatford/.gitmessage
> file:.git/config core.repositoryformatversion=0
> file:.git/config core.filemode=false
> file:.git/config core.bare=false
> file:.git/config core.logallrefupdates=true
> file:.git/config core.symlinks=false
> file:.git/config core.ignorecase=true
> file:.git/config remote.origin.url=
> https://github.com/danwatford/ofbiz-framework
> file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
> file:.git/config branch.trunk.remote=origin
> file:.git/config branch.trunk.merge=refs/heads/trunk
> file:.git/config branch.release18.12.remote=origin
> file:.git/config branch.release18.12.merge=refs/heads/release18.12
> file:.git/config remote.upstream.url=
> https://github.com/apache/ofbiz-framework
> file:.git/config
> remote.upstream.fetch=+refs/heads/*:refs/remotes/upstream/*
>
>
> Hopefully there might be some differences we can look into.
>
> Hope that helps,
>
> Dan.
>
> On Fri, 28 Feb 2020 at 09:34, Jacques Le Roux <
> jacques.le.roux@les7arts.com> wrote:
>
>>
>> Le 28/02/2020 à 10:22, Jacques Le Roux a écrit :
>> > Le 28/02/2020 à 10:07, Daniel Watford a écrit :
>> >> Hello,
>> >>
>> >> In my dev environment (Windows 10, IntelliJ, Git checking out with LF
>> line
>> >> endings) I see 39 checkstyle errors for our tests related to java
>> files not
>> >> ending with a newline.
>> >>
>> >> However on inspecting one of the files, ModelFormFieldTest, I can see
>> that
>> >> it does end with a newline.
>> >>
>> >> A quick google on the subject turned up
>> >>
>> https://stackoverflow.com/questions/997021/how-to-get-rid-of-checkstyle-message-file-does-not-end-with-a-newline
>> >> .
>> >>
>> >> It appears that checkstyle will assume the line endings of the
>> environment
>> >> where it is being run. In my case, Windows, it will assume line
>> endings of
>> >> CRLF, rather than the LF that I am using.
>> >>
>> >> If I modify the checkstyle configuration to specify LF for line endings
>> >> using:
>> >>
>> >> <module name="NewlineAtEndOfFile">
>> >>      <property name="lineSeparator" value="lf" />
>> >> </module>
>> >>
>> >> all the checkstyle errors in tests are resolved.
>> >>
>> >> *Question: Does anyone see any issues in telling Checkstyle to use LF
>> line
>> >> endings when it performs its checking?*
>> >>
>> >> The interesting thing was that even if I convert a file to use CRLF
>> line
>> >> endings, the above lineSeparator confgiuration for the
>> NewlineAtEndOfFile
>> >> checkstyle module would still pass.
>> >>
>> >> The above change also had the pleasant outcome of reducing checkstyle
>> >> errors for main code from 1055 files with violations to 956.
>> >>
>> >> Dan
>> >
>> > Hi Daniel,
>> >
>> > Thanks for this information, I use also Windows (7) and was just to the
>> point to look at the remaning issue with checkstyle.
>> >
>> > +1 for your proposition
>> >
>> > But I just tried after changing NewlineAtEndOfFile module as you
>> suggest, and got this
>> >
>> >    /C:\projectsASF\Git\ofbiz-framework>gradlew check > Configure
>> project : You are using one or more deprecated Asciidoctor task or plugins.
>> To help
>> >    with migration run with --warnings=all > Task :compileJava
>> UP-TO-DATE > Task :compileGroovy UP-TO-DATE > Task :processResources
>> UP-TO-DATE > Task
>> >    :classes UP-TO-DATE > Task :checkstyleMain Checkstyle rule
>> violations were found. See the report at:
>> >
>> file:///C:/projectsASF/Git/ofbiz-framework/build/reports/checkstyle/main.html
>> Checkstyle files with violations: 1038 Checkstyle violations by
>> >    severity: [error:37692] > Task :compileTestJava UP-TO-DATE > Task
>> :compileTestGroovy UP-TO-DATE > Task :processTestResources UP-TO-DATE > Task
>> >    :testClasses UP-TO-DATE > Task :checkstyleTest > Task :test FAILED
>> FAILURE: Build failed with an exception. * What went wrong: Execution failed
>> >    for task ':test'. > 120/
>> >
>> > Don't you have any checkstyle issues with trunk HEAD?
>> > I checked my Git local config and see no reasons, any ideas?
>> >
>> > Jacques
>> >
>> Also using
>>
>>     /    <module name="NewlineAtEndOfFile">//
>>     //        <property name="severity" value="ignore" />//
>>     //    </module>/
>>
>> Does not help, weird, isn't?
>>
>> I'll relaunch manually
>> https://ci.apache.org/builders/ofbizTrunkFramework/builds/1296
>>
>> Because https://ci.apache.org/projects/ofbiz/logs/trunk/framework/html/
>> makes no sense another Buildbot quirk ;)
>>
>> Jacques
>>
>>
>
> --
> Daniel Watford
>


-- 
Daniel Watford

Re: Checkstyle error: Files does not end with newline

Posted by Daniel Watford <da...@foomoo.co.uk>.
Hi Jacques,

I haven't been able to come up with an explanation for what you're seeing,
so through I'd post some of my configuration and results to see if we can
spot anything odd.

Building on a Windows 10 host. Executing builds from Git Bash running in
Windows terminal:

$ git log -1
commit 66aa76d7f7fc368b5f039d0e3181edaaf85d9b27 (HEAD -> trunk,
upstream/trunk, origin/trunk, origin/HEAD)
Merge: cfad407c48 0ece441228
Author: Jacques Le Roux <ja...@les7arts.com>
Date: Fri Feb 28 09:44:28 2020 +0100

Merge pull request #35 from danwatford/ofbiz-11418-documentation

OFBIZ-11418: Fixed line lengths in ModelFormFieldTest to adhere to coding
standards

$ git status
On branch trunk
Your branch is up to date with 'origin/trunk'.

nothing to commit, working tree clean


$ ./gradlew clean

> Configure project :
You are using one or more deprecated Asciidoctor task or plugins. To help
with migration run with --warnings=all

> Task :clean

BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed

Windows Terminal
$ ./gradlew check

> Configure project :
You are using one or more deprecated Asciidoctor task or plugins. To help
with migration run with --warnings=all

> Task :compileJava
> Task :compileGroovy
> Task :processResources
> Task :classes

> Task :checkstyleMain
Checkstyle rule violations were found. See the report at:
file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/main.html
Checkstyle files with violations: 1055
Checkstyle violations by severity: [error:35504]


> Task :compileTestJava
C:\dev\clients\ActiveTransport\activate-docker-ofbiz-framework\ofbiz\framework\widget\src\test\java\org\apache\ofbiz\widget\model\ModelFormFieldTest.java:128:
warning: [deprecation] getTargetParameterList() in
LookupField has been deprecated
assertThat(lookupField.getTargetParameterList(),
Matchers.contains("${prefix}TargetParam", "${key1}"));
^
1 warning

> Task :compileTestGroovy
> Task :processTestResources
> Task :testClasses
> Task :checkstyleTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':checkstyleTest'.
> Checkstyle rule violations were found. See the report at:
file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/test.html
Checkstyle files with violations: 39
Checkstyle violations by severity: [error:39]


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or
--debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 30s
8 actionable tasks: 8 executed



If I then apply the change to config/checkstyle/checkstyle.xml:
Index: config/checkstyle/checkstyle.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- config/checkstyle/checkstyle.xml (revision
66aa76d7f7fc368b5f039d0e3181edaaf85d9b27)
+++ config/checkstyle/checkstyle.xml (date 1582884183549)
@@ -30,7 +30,9 @@
     <property name="fileExtensions" value="java, properties, xml"/>

     <!-- General file conventions -->
-    <module name="NewlineAtEndOfFile"/>
+    <module name="NewlineAtEndOfFile">
+        <property name="lineSeparator" value="lf" />
+    </module>
     <module name="FileTabCharacter"/>
     <module name="RegexpSingleline">
        <property name="format" value="\s+$"/>

And re-run checkstyle:
$ ./gradlew check

> Configure project :
You are using one or more deprecated Asciidoctor task or plugins. To help
with migration run with --warnings=all

> Task :compileJava UP-TO-DATE
> Task :compileGroovy UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE

> Task :checkstyleMain
Checkstyle rule violations were found. See the report at:
file:///C:/dev/clients/ActiveTransport/activate-docker-ofbiz-framework/ofbiz/build/reports/checkstyle/main.html
Checkstyle files with violations: 956
Checkstyle violations by severity: [error:34464]


> Task :compileTestJava UP-TO-DATE
> Task :compileTestGroovy UP-TO-DATE
> Task :processTestResources UP-TO-DATE
> Task :testClasses UP-TO-DATE
> Task :checkstyleTest
> Task :test
> Task :check

BUILD SUCCESSFUL in 40s
9 actionable tasks: 3 executed, 6 up-to-date



This time all the 39 test file violations have been cleared.

Just in case there are some LF / CRLF issues remaining in your work area
you could run something like the following (assuming you have cygwin / msys
/ git bash)
$ find . -path ./build -prune -o -not -type d -exec file "{}" ";" | grep
CRLF



My git config is as follows:
$ git config --list --show-origin | grep -v branch.ofbiz
file:C:/Program Files/Git/etc/gitconfig
diff.astextplain.textconv=astextplain
file:C:/Program Files/Git/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f
file:C:/Program Files/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge --
%f
file:C:/Program Files/Git/etc/gitconfig filter.lfs.process=git-lfs
filter-process
file:C:/Program Files/Git/etc/gitconfig filter.lfs.required=true
file:C:/Program Files/Git/etc/gitconfig http.sslbackend=openssl
file:C:/Program Files/Git/etc/gitconfig http.sslcainfo=C:/Program
Files/Git/mingw64/ssl/certs/ca-bundle.crt
file:C:/Program Files/Git/etc/gitconfig core.autocrlf=input
file:C:/Program Files/Git/etc/gitconfig core.fscache=true
file:C:/Program Files/Git/etc/gitconfig core.symlinks=false
file:C:/Program Files/Git/etc/gitconfig credential.helper=manager
file:C:/Users/DanielWatford/.gitconfig user.name=Daniel Watford
file:C:/Users/DanielWatford/.gitconfig user.email=
daniel@watfordconsulting.com
file:C:/Users/DanielWatford/.gitconfig
commit.template=C:/Users/DanielWatford/.gitmessage
file:.git/config core.repositoryformatversion=0
file:.git/config core.filemode=false
file:.git/config core.bare=false
file:.git/config core.logallrefupdates=true
file:.git/config core.symlinks=false
file:.git/config core.ignorecase=true
file:.git/config remote.origin.url=
https://github.com/danwatford/ofbiz-framework
file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config branch.trunk.remote=origin
file:.git/config branch.trunk.merge=refs/heads/trunk
file:.git/config branch.release18.12.remote=origin
file:.git/config branch.release18.12.merge=refs/heads/release18.12
file:.git/config remote.upstream.url=
https://github.com/apache/ofbiz-framework
file:.git/config remote.upstream.fetch=+refs/heads/*:refs/remotes/upstream/*


Hopefully there might be some differences we can look into.

Hope that helps,

Dan.

On Fri, 28 Feb 2020 at 09:34, Jacques Le Roux <ja...@les7arts.com>
wrote:

>
> Le 28/02/2020 à 10:22, Jacques Le Roux a écrit :
> > Le 28/02/2020 à 10:07, Daniel Watford a écrit :
> >> Hello,
> >>
> >> In my dev environment (Windows 10, IntelliJ, Git checking out with LF
> line
> >> endings) I see 39 checkstyle errors for our tests related to java files
> not
> >> ending with a newline.
> >>
> >> However on inspecting one of the files, ModelFormFieldTest, I can see
> that
> >> it does end with a newline.
> >>
> >> A quick google on the subject turned up
> >>
> https://stackoverflow.com/questions/997021/how-to-get-rid-of-checkstyle-message-file-does-not-end-with-a-newline
> >> .
> >>
> >> It appears that checkstyle will assume the line endings of the
> environment
> >> where it is being run. In my case, Windows, it will assume line endings
> of
> >> CRLF, rather than the LF that I am using.
> >>
> >> If I modify the checkstyle configuration to specify LF for line endings
> >> using:
> >>
> >> <module name="NewlineAtEndOfFile">
> >>      <property name="lineSeparator" value="lf" />
> >> </module>
> >>
> >> all the checkstyle errors in tests are resolved.
> >>
> >> *Question: Does anyone see any issues in telling Checkstyle to use LF
> line
> >> endings when it performs its checking?*
> >>
> >> The interesting thing was that even if I convert a file to use CRLF line
> >> endings, the above lineSeparator confgiuration for the
> NewlineAtEndOfFile
> >> checkstyle module would still pass.
> >>
> >> The above change also had the pleasant outcome of reducing checkstyle
> >> errors for main code from 1055 files with violations to 956.
> >>
> >> Dan
> >
> > Hi Daniel,
> >
> > Thanks for this information, I use also Windows (7) and was just to the
> point to look at the remaning issue with checkstyle.
> >
> > +1 for your proposition
> >
> > But I just tried after changing NewlineAtEndOfFile module as you
> suggest, and got this
> >
> >    /C:\projectsASF\Git\ofbiz-framework>gradlew check > Configure project
> : You are using one or more deprecated Asciidoctor task or plugins. To help
> >    with migration run with --warnings=all > Task :compileJava UP-TO-DATE
> > Task :compileGroovy UP-TO-DATE > Task :processResources UP-TO-DATE > Task
> >    :classes UP-TO-DATE > Task :checkstyleMain Checkstyle rule violations
> were found. See the report at:
> >
> file:///C:/projectsASF/Git/ofbiz-framework/build/reports/checkstyle/main.html
> Checkstyle files with violations: 1038 Checkstyle violations by
> >    severity: [error:37692] > Task :compileTestJava UP-TO-DATE > Task
> :compileTestGroovy UP-TO-DATE > Task :processTestResources UP-TO-DATE > Task
> >    :testClasses UP-TO-DATE > Task :checkstyleTest > Task :test FAILED
> FAILURE: Build failed with an exception. * What went wrong: Execution failed
> >    for task ':test'. > 120/
> >
> > Don't you have any checkstyle issues with trunk HEAD?
> > I checked my Git local config and see no reasons, any ideas?
> >
> > Jacques
> >
> Also using
>
>     /    <module name="NewlineAtEndOfFile">//
>     //        <property name="severity" value="ignore" />//
>     //    </module>/
>
> Does not help, weird, isn't?
>
> I'll relaunch manually
> https://ci.apache.org/builders/ofbizTrunkFramework/builds/1296
>
> Because https://ci.apache.org/projects/ofbiz/logs/trunk/framework/html/
> makes no sense another Buildbot quirk ;)
>
> Jacques
>
>

-- 
Daniel Watford

Re: Checkstyle error: Files does not end with newline

Posted by Jacques Le Roux <ja...@les7arts.com>.
Le 28/02/2020 à 10:22, Jacques Le Roux a écrit :
> Le 28/02/2020 à 10:07, Daniel Watford a écrit :
>> Hello,
>>
>> In my dev environment (Windows 10, IntelliJ, Git checking out with LF line
>> endings) I see 39 checkstyle errors for our tests related to java files not
>> ending with a newline.
>>
>> However on inspecting one of the files, ModelFormFieldTest, I can see that
>> it does end with a newline.
>>
>> A quick google on the subject turned up
>> https://stackoverflow.com/questions/997021/how-to-get-rid-of-checkstyle-message-file-does-not-end-with-a-newline
>> .
>>
>> It appears that checkstyle will assume the line endings of the environment
>> where it is being run. In my case, Windows, it will assume line endings of
>> CRLF, rather than the LF that I am using.
>>
>> If I modify the checkstyle configuration to specify LF for line endings
>> using:
>>
>> <module name="NewlineAtEndOfFile">
>>      <property name="lineSeparator" value="lf" />
>> </module>
>>
>> all the checkstyle errors in tests are resolved.
>>
>> *Question: Does anyone see any issues in telling Checkstyle to use LF line
>> endings when it performs its checking?*
>>
>> The interesting thing was that even if I convert a file to use CRLF line
>> endings, the above lineSeparator confgiuration for the NewlineAtEndOfFile
>> checkstyle module would still pass.
>>
>> The above change also had the pleasant outcome of reducing checkstyle
>> errors for main code from 1055 files with violations to 956.
>>
>> Dan
>
> Hi Daniel,
>
> Thanks for this information, I use also Windows (7) and was just to the point to look at the remaning issue with checkstyle.
>
> +1 for your proposition
>
> But I just tried after changing NewlineAtEndOfFile module as you suggest, and got this
>
>    /C:\projectsASF\Git\ofbiz-framework>gradlew check > Configure project : You are using one or more deprecated Asciidoctor task or plugins. To help
>    with migration run with --warnings=all > Task :compileJava UP-TO-DATE > Task :compileGroovy UP-TO-DATE > Task :processResources UP-TO-DATE > Task
>    :classes UP-TO-DATE > Task :checkstyleMain Checkstyle rule violations were found. See the report at:
> file:///C:/projectsASF/Git/ofbiz-framework/build/reports/checkstyle/main.html Checkstyle files with violations: 1038 Checkstyle violations by
>    severity: [error:37692] > Task :compileTestJava UP-TO-DATE > Task :compileTestGroovy UP-TO-DATE > Task :processTestResources UP-TO-DATE > Task
>    :testClasses UP-TO-DATE > Task :checkstyleTest > Task :test FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed
>    for task ':test'. > 120/
>
> Don't you have any checkstyle issues with trunk HEAD?
> I checked my Git local config and see no reasons, any ideas?
>
> Jacques
>
Also using

    /    <module name="NewlineAtEndOfFile">//
    //        <property name="severity" value="ignore" />//
    //    </module>/

Does not help, weird, isn't?

I'll relaunch manually https://ci.apache.org/builders/ofbizTrunkFramework/builds/1296

Because https://ci.apache.org/projects/ofbiz/logs/trunk/framework/html/ makes no sense another Buildbot quirk ;)

Jacques


Re: Checkstyle error: Files does not end with newline

Posted by Jacques Le Roux <ja...@les7arts.com>.
Le 28/02/2020 à 10:07, Daniel Watford a écrit :
> Hello,
>
> In my dev environment (Windows 10, IntelliJ, Git checking out with LF line
> endings) I see 39 checkstyle errors for our tests related to java files not
> ending with a newline.
>
> However on inspecting one of the files, ModelFormFieldTest, I can see that
> it does end with a newline.
>
> A quick google on the subject turned up
> https://stackoverflow.com/questions/997021/how-to-get-rid-of-checkstyle-message-file-does-not-end-with-a-newline
> .
>
> It appears that checkstyle will assume the line endings of the environment
> where it is being run. In my case, Windows, it will assume line endings of
> CRLF, rather than the LF that I am using.
>
> If I modify the checkstyle configuration to specify LF for line endings
> using:
>
> <module name="NewlineAtEndOfFile">
>      <property name="lineSeparator" value="lf" />
> </module>
>
> all the checkstyle errors in tests are resolved.
>
> *Question: Does anyone see any issues in telling Checkstyle to use LF line
> endings when it performs its checking?*
>
> The interesting thing was that even if I convert a file to use CRLF line
> endings, the above lineSeparator confgiuration for the NewlineAtEndOfFile
> checkstyle module would still pass.
>
> The above change also had the pleasant outcome of reducing checkstyle
> errors for main code from 1055 files with violations to 956.
>
> Dan

Hi Daniel,

Thanks for this information, I use also Windows (7) and was just to the point to look at the remaning issue with checkstyle.

+1 for your proposition

But I just tried after changing NewlineAtEndOfFile module as you suggest, and got this

    /C:\projectsASF\Git\ofbiz-framework>gradlew check > Configure project : You are using one or more deprecated Asciidoctor task or plugins. To help
    with migration run with --warnings=all > Task :compileJava UP-TO-DATE > Task :compileGroovy UP-TO-DATE > Task :processResources UP-TO-DATE > Task
    :classes UP-TO-DATE > Task :checkstyleMain Checkstyle rule violations were found. See the report at:
    file:///C:/projectsASF/Git/ofbiz-framework/build/reports/checkstyle/main.html Checkstyle files with violations: 1038 Checkstyle violations by
    severity: [error:37692] > Task :compileTestJava UP-TO-DATE > Task :compileTestGroovy UP-TO-DATE > Task :processTestResources UP-TO-DATE > Task
    :testClasses UP-TO-DATE > Task :checkstyleTest > Task :test FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed
    for task ':test'. > 120/

Don't you have any checkstyle issues with trunk HEAD?
I checked my Git local config and see no reasons, any ideas?

Jacques