Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-11939

Provide a way to add custom xdoc files to describe the checkstyle rules

      As the xdoc files are used to show a description in the detailled view, it would be a great improvement if we could provide some files to populatre it for the extended checkstyle rules.

      It could be an option available in the global admin section and it would be used in the detailled tab of your plugin.

      I tried to implementing it on my own but I am afraid my changes were too intrusive so I am asking you how you would implement it.

      Do you think this is useful and/or not too difficult to create?

      Regards,

      – Yoann Ciabaud

          [JENKINS-11939] Provide a way to add custom xdoc files to describe the checkstyle rules

          yciabaud created issue -

          Ulli Hafner added a comment - - edited

          Can I assume that these additional rules are private ones used only in your use case?

          Then a system configuration section would be a good approach. I'm not sure if I understand: what do you mean with too intrusive?

          I think the following approach would work:

          • Create a system configuration page (an example would be the warnings plug-in that has user defined parsers)
          • In Class CheckStyleRules, read the additional files. Additionally, this class must not be a singleton any more. I.e. a new instance needs to be returned. (I think the parsing results should be cached anyway...)

          I'm not sure how many people use own rules but I think it does not hurt if you can upload additional rules. I think it would be also possible to overwrite the system files if that makes sense at all.

          Ulli Hafner added a comment - - edited Can I assume that these additional rules are private ones used only in your use case? Then a system configuration section would be a good approach. I'm not sure if I understand: what do you mean with too intrusive? I think the following approach would work: Create a system configuration page (an example would be the warnings plug-in that has user defined parsers) In Class CheckStyleRules, read the additional files. Additionally, this class must not be a singleton any more. I.e. a new instance needs to be returned. (I think the parsing results should be cached anyway...) I'm not sure how many people use own rules but I think it does not hurt if you can upload additional rules. I think it would be also possible to overwrite the system files if that makes sense at all.

          yciabaud added a comment -

          I am coding an xml checkstyle extension for my needs but I am sharing it on https://github.com/yciabaud/checkstyle-xml-ext

          I don't think I have any user for now but there must be other projects which extends Checkstyle to implement new rules for Java files or other types.
          It would be great for them if they can add a xdoc for their rules.

          Mine is located at https://github.com/yciabaud/checkstyle-xml-ext/blob/master/src/xdoc/config_xml.xml for example.

          I modified the getInstance method in the singleton to add the location parameter (it was way too dirty) and I had to modify 2 other classes to bring my parameter into it. Then I was not sure how the xdoc parsing is working... As I know you are a good maintainer, I decided to rollback those ugly modifications and talk to you to see if we could make it without making the code that horrible

          I agree with your approach but I am not experimented enough in Jenkins dev to make it real.

          Do you think you could make this improvement when you got time?
          Of course there is no emergency

          Thank you very much.

          yciabaud added a comment - I am coding an xml checkstyle extension for my needs but I am sharing it on https://github.com/yciabaud/checkstyle-xml-ext I don't think I have any user for now but there must be other projects which extends Checkstyle to implement new rules for Java files or other types. It would be great for them if they can add a xdoc for their rules. Mine is located at https://github.com/yciabaud/checkstyle-xml-ext/blob/master/src/xdoc/config_xml.xml for example. I modified the getInstance method in the singleton to add the location parameter (it was way too dirty) and I had to modify 2 other classes to bring my parameter into it. Then I was not sure how the xdoc parsing is working... As I know you are a good maintainer, I decided to rollback those ugly modifications and talk to you to see if we could make it without making the code that horrible I agree with your approach but I am not experimented enough in Jenkins dev to make it real. Do you think you could make this improvement when you got time? Of course there is no emergency Thank you very much.

          jan_ruzicka added a comment -

          Would use of PHP Code Sniffer producing checkstyle reports be a case for using the xdoc files?

          Currently each entry shows "No description available. Please upgrade to latest checkstyle version.".

          Would the xdoc address this issue?

          jan_ruzicka added a comment - Would use of PHP Code Sniffer producing checkstyle reports be a case for using the xdoc files? Currently each entry shows "No description available. Please upgrade to latest checkstyle version.". Would the xdoc address this issue?

          Ulli Hafner added a comment -

          I think that would be a similar use case. Are the xdoc files available for PHP Code Sniffer?

          Ulli Hafner added a comment - I think that would be a similar use case. Are the xdoc files available for PHP Code Sniffer?
          Ulli Hafner made changes -
          Labels New: PR-appreciated
          Ulli Hafner made changes -
          Assignee Original: Ulli Hafner [ drulli ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 142211 ] New: JNJira + In-Review [ 175629 ]
          Ulli Hafner made changes -
          Link New: This issue is related to JENKINS-39940 [ JENKINS-39940 ]

            Unassigned Unassigned
            yciabaud yciabaud
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: