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

Add EditorConfig to Enforce Code-Styles Consistency #72

Closed
11 tasks done
tajmone opened this issue Sep 16, 2020 · 0 comments
Closed
11 tasks done

Add EditorConfig to Enforce Code-Styles Consistency #72

tajmone opened this issue Sep 16, 2020 · 0 comments
Assignees
Labels
🕑 WIP Work in progress (possibly with tasks list). 🔨 alan-xsl-fopub Tool: alan-xsl-fopub (DocBook PDF template) 🔨 EClint Tool: EClint (EditorConfig validator) 🔨 EditorConfig Tool: EditorConfig for code-styles consistency 🔨 Travis CI Tool: Travis CI ⭐ automation Topic: Project automation and/or repo CI ⚠️ important Priority: High

Comments

@tajmone
Copy link
Collaborator

tajmone commented Sep 16, 2020

  • Create new dev-editorconfig branch, and:
    • Add EditorConfig settings to enforce code styles consistency in the various files types across all OSs and editors/IDEs.
    • Add script to validate code styles consistency via EClint (NPM) locally, to allow contributors to check their changes before committing.
    • Amend all sources until they pass the validation test.
  • Enable code styles consistency checks via Travis CI, to ensure that all commits and PRs are well formatted.
  • Merge into master branch.
  • Fix dev branches:
    • Rebase on master and
    • Amend all sources until they pass the validation test.

In order to pass the validation test, we also need to enforce EditorConfig setting in the /alan-xsl-fopub/ repository included in this repo as Git submodule:

  • Add EditorConfig settings to alan-xsl-fopub repository.
  • Update the Git Submodule pointer in this repository.

Since the alan-xsl-fopub repository will define it's EditorConfig settings as root = true, the validation tool will use those setting inside the Git submodule directory.


Thanks to EditorConfig we'll be able to enforce consistent code styles in the repository, and all modern editors should pick up those settings and enforce them over the user default settings when working on this repo — either natively or by installing a third party EditorConfig plug-in.

@thoni56, for Emacs you'll find an EditorConfig plugin here:

Hopefully the adoption of EditorConfig will solve many of the current conflicts due to noise changes added to the code due to different settings for indentation, trailing spaces, etc. I've been using it a lot in my repos during the past year, and it has improved the working experience a lot.

@tajmone tajmone added ⚠️ important Priority: High ⭐ automation Topic: Project automation and/or repo CI 🔨 EditorConfig Tool: EditorConfig for code-styles consistency 🔨 EClint Tool: EClint (EditorConfig validator) 🔨 Travis CI Tool: Travis CI labels Sep 16, 2020
@tajmone tajmone self-assigned this Sep 16, 2020
@tajmone tajmone pinned this issue Sep 16, 2020
@tajmone tajmone added the 🔨 alan-xsl-fopub Tool: alan-xsl-fopub (DocBook PDF template) label Sep 16, 2020
tajmone added a commit that referenced this issue Sep 16, 2020
Add proper configurations to `.editorconfig` and `gitattributes`, and
polish all Git settings files (See #72).

Add `validate.sh` script to check that all sources meet the new code
styles conventions, via the EClint tool (Node.js):

    https://www.npmjs.com/package/eclint

Enable Travis CI validation of code styles consistency in every commit
and PR, via the `validate.sh` script.
@tajmone tajmone added the 🕑 WIP Work in progress (possibly with tasks list). label Sep 16, 2020
tajmone added a commit to alan-if/alan-xsl-fopub that referenced this issue Sep 17, 2020
Add EditorConfig settings to enforce code style consistency across OSs
and editors, enable validation via Travis CI using EClint:

    https://www.npmjs.com/package/eclint

Update and polish other Git settings files.

Polish repository sources to meet the new code styles conventions.

(See: alan-if/alan-docs#72)

**NOTE** EClint seems to fail to validate properly the DocBook sources
         (.xml/.xsl). Various tests revealed that all other files types
         are being validate correctly, whereas for those extensions it
         fails to detect any errors and always reports them as good.
         Must be an EClint bug (one of the many).
tajmone added a commit that referenced this issue Sep 17, 2020
Update the alan-xsl-fopub submodule to the latest version, which added
its own EditorConfig settings to prevent the settings of the Alan-Docs
repo to be applied also to the submodule's directory. (See #72)
tajmone added a commit that referenced this issue Sep 17, 2020
Add proper configurations to `.editorconfig` and `gitattributes`, and
polish all Git settings files (See #72).

Add `validate.sh` script to check that all sources meet the new code
styles conventions, via the EClint tool (Node.js):

    https://www.npmjs.com/package/eclint

Enable Travis CI validation of code styles consistency in every commit
and PR, via the `validate.sh` script.
tajmone added a commit that referenced this issue Sep 17, 2020
Update the alan-xsl-fopub submodule to the latest version, which added
its own EditorConfig settings to prevent the settings of the Alan-Docs
repo to be applied also to the submodule's directory. (See #72)
tajmone added a commit that referenced this issue Sep 17, 2020
Amend all markdown files until they pass EditorConfig validation via
EClint. (See #72)
tajmone added a commit that referenced this issue Sep 17, 2020
Amend all shell and batch scripts to pass EditorConfig validation via
EClint. (See #72)
tajmone added a commit that referenced this issue Sep 17, 2020
Amend all ALAN source files until they pass EditorConfig validation via
EClint. (See #72) Most changes consist in adding an empty line at the
file end, especially in the ALAN Guide `lib/` and `mylib/` folders.

Note that due to EClint's poor support for Latin1 validation, some ALAN
sources containing non-ASCII characters are being excluded from econding
validation/enforcement via `charset=unset` (See #73).
tajmone added a commit that referenced this issue Sep 17, 2020
Amend two AsciiDoc sources that didn't pass EditorConfig validation via
EClint. (See #72)
@tajmone tajmone closed this as completed Sep 18, 2020
@tajmone tajmone unpinned this issue Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕑 WIP Work in progress (possibly with tasks list). 🔨 alan-xsl-fopub Tool: alan-xsl-fopub (DocBook PDF template) 🔨 EClint Tool: EClint (EditorConfig validator) 🔨 EditorConfig Tool: EditorConfig for code-styles consistency 🔨 Travis CI Tool: Travis CI ⭐ automation Topic: Project automation and/or repo CI ⚠️ important Priority: High
Projects
None yet
Development

No branches or pull requests

1 participant