Duo Zhang created HBASE-26918:
---------------------------------

             Summary: Remove some checks in checkstyle
                 Key: HBASE-26918
                 URL: https://issues.apache.org/jira/browse/HBASE-26918
             Project: HBase
          Issue Type: Sub-task
            Reporter: Duo Zhang


After enableing spotless, maybe we can remove some checks in checkstyle as it 
is useless now, such as indentation check. The spotless plugin will try its 
best to format the code, and if checkstyle still think it is not suitable, we 
have no way to improve.

This is an example:

{code}
  public ScreenView transitionToFieldScreen(Screen screen, Terminal terminal) {
    return new FieldScreenView(screen, terminal, 
topScreenModel.getCurrentSortField(),
      topScreenModel.getFields(), fieldDisplayMap, (sortField, fields, 
fieldDisplayMap) -> {
        topScreenModel.setSortFieldAndFields(sortField, fields);
        this.fieldDisplayMap.clear();
        this.fieldDisplayMap.putAll(fieldDisplayMap);
      }, topScreenView);
  }
{code}

I think the indentation is very clear to human but checkstyle reports the 
'topScreenModel.setSortFieldAndFields(sortField, fields);' should have 
indentation 6 instead of 8.

In the same file, there is another example
{code}
    return new InputModeScreenView(screen, terminal, row,
      "add filter #" + (topScreenModel.getFilters().size() + 1) + " ("
        + (ignoreCase ? "ignoring case" : "case sensitive") + ") as: 
[!]FLD?VAL",
      topScreenModel.getFilterHistories(), (inputString) -> {
        if (inputString.isEmpty()) {
          return topScreenView;
        }

        if (!topScreenModel.addFilter(inputString, ignoreCase)) {
          return goToMessageMode(screen, terminal, row, "Unacceptable filter 
expression");
        }

        paging.init();
        return topScreenView;
      });
{code}
Checkstyle reports the indentation for ' if (inputString.isEmpty()) {' should 
be 6 instead of 8, but for me I think the current indentation is more clear for 
human.

So after reviewing all the indentation problem and tweaking the eclipse 
formatter, I think we could remove the indentation check in our checkstyle 
config.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to