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

[BUG] Spotless doesn't replace tabs|spaces with spaces|tabs in JSON #39

Closed
2 tasks
dbwiddis opened this issue Sep 15, 2023 · 2 comments · Fixed by #26
Closed
2 tasks

[BUG] Spotless doesn't replace tabs|spaces with spaces|tabs in JSON #39

dbwiddis opened this issue Sep 15, 2023 · 2 comments · Fixed by #26
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@dbwiddis
Copy link
Member

What is the bug?

JSON files with tabs aren't replaced by spaces like any sane formatter should do.

Or if we prefer tabs, spaces aren't being replaced by tabs.

How can one reproduce the bug?

  1. Save a JSON file with tabs (accidentally, of course) and another one with spaces in an IDE configured for 4-space indent.
  2. Run ./gradlew spotlessApply
  3. Observe that no changes have occurred, and the result looks different on different editors/environments (e.g., GitHub which for some insane reason loves 8 character tab indent)

What is the expected behavior?

Pick one:

  • No tabs used as indentation in any files representing structured data (like YAML or JSON).
  • Tabs always used as indentation in any files representing structured data (like YAML or JSON).

Do you have any screenshots?

Screenshot 2023-09-14 at 5 22 27 PM

Do you have any additional context?

https://www.reddit.com/r/programming/comments/p1j1c/tabs_vs_spaces_vs_both/

@dbwiddis dbwiddis added bug Something isn't working untriaged labels Sep 15, 2023
@dbwiddis dbwiddis added good first issue Good for newcomers and removed untriaged labels Sep 15, 2023
@dbwiddis
Copy link
Member Author

Apparently tabs are forbidden in OpenSearch so we. must use spaces.

Execution failed for task ':forbiddenPatterns'.
> Found invalid patterns:
  - tab on line 2 of src/test/resources/template/datademo.json
  - tab on line 3 of src/test/resources/template/datademo.json
  - tab on line 4 of src/test/resources/template/datademo.json
  - tab on line 5 of src/test/resources/template/datademo.json
  - tab on line 6 of src/test/resources/template/datademo.json
  - tab on line 7 of src/test/resources/template/datademo.json
  - tab on line 8 of src/test/resources/template/datademo.json
  - tab on line 9 of src/test/resources/template/datademo.json
  - tab on line 10 of src/test/resources/template/datademo.json
  - tab on line 11 of src/test/resources/template/datademo.json
  - tab on line 12 of src/test/resources/template/datademo.json
  - tab on line 13 of src/test/resources/template/datademo.json
  - tab on line 14 of src/test/resources/template/datademo.json
  - tab on line 15 of src/test/resources/template/datademo.json
  - tab on line 16 of src/test/resources/template/datademo.json
  - tab on line 17 of src/test/resources/template/datademo.json
  - tab on line 18 of src/test/resources/template/datademo.json
  - tab on line 19 of src/test/resources/template/datademo.json
  - ```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant