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

Formatting breaks code, converting else if into elseif in some cases #127

Closed
daveschoutens opened this issue Nov 11, 2020 · 5 comments · Fixed by #126
Closed

Formatting breaks code, converting else if into elseif in some cases #127

daveschoutens opened this issue Nov 11, 2020 · 5 comments · Fixed by #126
Labels
bug Something isn't working

Comments

@daveschoutens
Copy link

After running npm-groovy-lint --format on a project, I noticed it resulted in several compilation issues.

I tried to whittle the problematic code down to a minimal-ish example:

    boolean foo(boolean a, boolean b) {
        if (a) {
            return true
        } else if(b) { // post-format, this breaks (ends up as `elseif`)
            return true
        }
    }

I found that if I add a space, like else if (b) { it stops exhibiting this behavior, but I'm not sure if that's the whole story.

@nvuillam
Copy link
Owner

That's nasty ^^
Reproduced, I'm on it ^^

nvuillam added a commit that referenced this issue Nov 12, 2020
#127
Formatting breaks code, converting `else if` into `elseif` in some cases
@nvuillam
Copy link
Owner

nvuillam commented Nov 12, 2020

I fixed the issue and released it in a beta version of next major release, please can you confirm it's ok with your whole file ? :)

npm install -g [email protected]

@nvuillam
Copy link
Owner

Addendum: i had an beta release issue, so the beta to use is [email protected] , not [email protected]

@daveschoutens
Copy link
Author

Looks like it's fixed 👍

Thanks!

@nvuillam
Copy link
Owner

Great :)
I'll close the issue when it will be delivered in main release and not beta ^^
Don't hesitate to notify if you see issues with the beta :) ( all test cases pass, but I still have some issues with VsCode Groovy Lint)

@nvuillam nvuillam added the bug Something isn't working label Nov 14, 2020
nvuillam added a commit that referenced this issue Nov 15, 2020
- Upgrade to CodeNarc 2.0.0
  - Upgrade jars
  - Adapt Indentation rule to new behaviour
  - Use codenarc --ruleset argument instead of temp ruleset file
- Replace super-linter by [Mega-Linter](https://nvuillam.github.io/mega-linter/)
- Fixes
  - [(#127)](#127) Formatting breaks code, converting `else if` into `elseif` in some cases
  - Apply formatting rules also for --fix mode
  - Fix Markdown dead links
- CI
  - Migrate from CircleCI to GitHub Actions: now tests are on Linux, Windows & MacOs
  - Activate spelling linter of Mega-Linter (+ `.cspell.json` file)
  - Add test cases for format and fix using CLI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants