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

Unable to disable indentation formatting #378

Open
logicbomb421 opened this issue Jul 22, 2024 · 2 comments
Open

Unable to disable indentation formatting #378

logicbomb421 opened this issue Jul 22, 2024 · 2 comments

Comments

@logicbomb421
Copy link

It seems indentation is a common issue among users of CodeNarc, which I am aware this tool uses under the hood.

Our team has elected to disable the indentation rules entirely sine they are currently producing some odd results. However, when setting enabled: false for this rule, indentation is still modified on a call using --fix or --format.

For example, consider the following .groovylintrc.json file:

{
  "extends": "recommended",
  "rules": {
    "Indentation": {
      "enabled": false
    }
  }
}

and the following Groovy snippet:

int example(int arg) {
  if (arg == 1
      || arg == 2
      || arg == 3) {
      print(arg)
  } else {
        print(-1)
  }
}

When running the linter with npm-groovy-lint example.groovy --fix (or --format), the closing brace under else is still reformatted even though indentation should be disabled:

if (arg == 1
    || arg == 2
    || arg == 3) {
    print(arg)
} else {
      print(-1)
    }

I have tried formatting.Indentation in the config file, though that also does not change anything.

How can I disable indentation linting and formatting using this tool?

Thank you!


GroovyLint: Successfully processed CodeNarc: 
CodeNarc version 3.3.0
npm-groovy-lint version 14.6.0

Embeds:
CodeNarc version 3.3.0
- Groovy version 3.0.9 (superlite)
Copy link

This issue has been automatically marked as stale because it has not had recent activity.
It will be closed in 14 days if no further activity occurs.
Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

@nvuillam
Copy link
Owner

@logicbomb421 please can you run DEBUG=npm-groovy-lint npm-groovy-lint ... and share the log ?
It will tell use which rule has played with Indentation (there are other rules that can impact it)

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

2 participants