Я могу отключить жалобы CheckStyle для устаревших методов и классов?

Для Apache:

sudo apt-get -yq install apache2

Для SSH:

sudo apt-get -yq install openssh-server

Для Подрывной деятельности:

sudo apt-get -yq install subversion subversion-tools

, Если Вы хотели бы Вас, может объединить их в одну команду как:

sudo apt-get -yq install apache2 openssh-server subversion subversion-tools

я не могу помочь с остальными...

5
задан Allain Lalonde 11 October 2009 в 23:49
поделиться

1 ответ

I have two options for you:

  1. suppress the warning for each line manually

    This approach is less flexible as you have to maintain the suppression configuration each time you are shifting lines. But you can handle each occurrence individually.

    
    

    I don't know which check is causing your problem, so you have to replace YOURCHECK with the proper name. YOURCLASS names the java file, which contains the deprecated code, but you can insert .* to apply it to every file. YOURLINES is a comma-separated list of values, where each value is an integer or a range of integers denoted by integer-integer.

  2. use a comment to advise checkstyle to ignore warnings

    This solution allows you to deactivate checks for all deprecated members at once. But you have to follow a strict convention. You have to add a @deprecated comment to those members (, what you possibly do already) at the very last position, because this filter has a strict range of lines.

    /**
    * @deprecated I don't like this anymore.
    */
    public static String EXAMPLE = "example";
    

    This solutions needs a change within your configuration file. First you have to add FileContentsHolder as a child to TreeWalker.

    
     ...
     
     ...
    
    

    Now you may configure the SuppressWithNearbyCommentFilter which is part of the Checker module.

    
     ...
     
     
     
     
     
     ...
    
    

    If you decide to ignore only specific checks, adjust the checkFormat attribute. Or if you want to use another comment, change the commentFormat attribute. But it is very important, that you set influenceFormat to the right value. It tells checkstyle within how many lines after the comment it is due to ignore those checks.

P.S.: Note that the Eclipse CheckStyle plugin removes the FileContentsHolder module, when you change the configuration with its user interface, so you must not use it.

8
ответ дан 14 December 2019 в 04:42
поделиться
Другие вопросы по тегам:

Похожие вопросы: