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

CQ: Add .editorconfig and validate repo against it #4792

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
eb2af6d
CQ: Add a .gitattributes file to configure line endings for some file…
echoix Nov 30, 2024
9cfec78
CQ: Create an .editorconfig file
echoix Nov 30, 2024
5b1fa2f
checks: Validate repo against .editorconfig file in CI and pre-commit
echoix Nov 30, 2024
e0024b4
CQ: Set .raw and .laz files as binary in .gitattributes
echoix Nov 30, 2024
8bb7b62
CQ: Add exclusions for binary files
echoix Dec 1, 2024
9b9e284
CQ: Mark demolocation binary files in .gitattributes
echoix Dec 1, 2024
d2fd6eb
CQ: Use CRLF in .bat files
echoix Dec 1, 2024
69fc70b
CQ: Only use tab indentation in Makefiles
echoix Dec 1, 2024
79098a2
CI: Remove CRLF check from CI as not needed with editorconfig
echoix Dec 1, 2024
f4914bb
CQ: Set indent_size to 4 for makefiles
echoix Dec 1, 2024
b9e0d2a
CQ: Adjust tab indentation in v.voronoi Makefile
echoix Dec 1, 2024
545cc0b
CQ: Set .bat end of line to CRLF in .gitattributes
echoix Dec 1, 2024
3fef393
CQ: Normalize line endings to CRLF for .bat files
echoix Dec 22, 2024
4bc3e7c
CQ: Trim trailing whitespaces in #Rscript2.bat
echoix Dec 22, 2024
253a962
Remove fixed R batch exclusions from .editorconfig
echoix Dec 22, 2024
d548299
Fix end of line and trailing newline in R batch files
echoix Dec 22, 2024
6680322
Remove remaining fixed R batch exclusions from .editorconfig
echoix Dec 22, 2024
ea9ab10
Merge branch 'main' into editorconfig-checker
echoix Feb 18, 2025
f9618f2
checks: Allow markdown files to end with trailing whitespace with .ed…
echoix Feb 18, 2025
d533322
checks: Bump editorconfig-checker version to 3.2.0
echoix Feb 18, 2025
6f477af
Update line endings for gui/wxpython/docs/wxgui_sphinx/make.bat
echoix Feb 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# EditorConfig: https://editorconfig.org
# Rules are read from top to bottom, the most recent rule found applies
# Some basic properties are supported by all editor plugins

# top-most EditorConfig file
root = true

# General settings
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true

[*.{htm,html,js,css,svg}]
indent_size = 2

[*.{xml,config}]
indent_size = 2

# Scripts
[{*.sh,mswindows/osgeo4w/*config}]
end_of_line = lf
indent_size = 4

# These are explicitly windows files and should use crlf
[*.{bat,cmd,ps1}{.tmpl,}]
end_of_line = crlf

[*.{c,h,cpp,hpp}]
indent_size = 2

[{*.js,*.json,*.json5,*.mjs,*.cjs}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

[*.js]
block_comment_start = /**
block_comment = *
block_comment_end = */

[*.ipynb]
end_of_line = lf

[{*.py, *.pyi}]
charset = utf-8
indent_style = space
# TODO: To enable when files are fixed:
# indent_size = 4
# max_line_length = 88

[{Makefile,*.make,*.make.in}]
# TODO: To enable when files are fixed:
# indent_style = tab
indent_size = 4

[*.y{a,}ml]
indent_style = space
indent_size = 2

# Patch files
[*.patch]
trim_trailing_whitespace = false

# TODO: To enable when files are fixed:
# # CSVs use CRLF as defined in RFC 4180
# [*.csv]
# end_of_line = crlf

[*.md]
# Two trailing whitespace in markdown means to create a line break
# https://www.markdownguide.org/basic-syntax/#line-breaks
trim_trailing_whitespace = false
indent_style = space
# TODO: To enable when files are fixed:
# indent_size = 2

# Exclude some files from rules
[*.{ascii,asc,ref,po,ps,svg}]
trim_trailing_whitespace = unset
end_of_line = unset
charset = unset
insert_final_newline = unset

[{**/testsuite/data/**,mswindows/osgeo4w/envdiff.sed}]
trim_trailing_whitespace = unset
end_of_line = unset
charset = unset
insert_final_newline = unset

[python/libgrass_interface_generator/ctypesgen/parser/parsetab.py]
trim_trailing_whitespace = false

[mswindows/{generic.manifest,Installer-Files/*.url}]
end_of_line = crlf

# Binary files
[**/PERMANENT/vector/*/{cidx,coor,sidx,topo}]
trim_trailing_whitespace = unset
end_of_line = unset
charset = unset
insert_final_newline = unset

[*.{laz,raw,rgb}]
trim_trailing_whitespace = unset
end_of_line = unset
charset = unset
insert_final_newline = unset

[{lib/vector/diglib/test*.ok,**/*.nib/keyedobjects.nib}]
trim_trailing_whitespace = unset
end_of_line = unset
charset = unset
insert_final_newline = unset
20 changes: 20 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# TODO: Enable the following with a related change in .editorconfig:
# *.csv text eol=crlf

# Scripts
*.bash text eol=lf
*.sh text eol=lf
# Windows scripts should be CRLF
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf

# Jupyter notebooks
*.ipynb text eol=lf

# Binary files
*.raw binary
*.laz binary
*/PERMANENT/vector/*/[cs]idx binary
*/PERMANENT/vector/*/coor binary
*/PERMANENT/vector/*/topo binary
3 changes: 0 additions & 3 deletions .github/workflows/.editorconfig

This file was deleted.

6 changes: 0 additions & 6 deletions .github/workflows/additional_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ jobs:
precommit:
- '.pre-commit-config.yaml'

- name: Check for CRLF endings
uses: erclu/check-crlf@94acb86c2a41b0a46bd8087b63a06f0457dd0c6c # v1.2.0
with:
# Ignore all test data, Windows-specific directories and scripts.
exclude: mswindows .*\.bat .*/testsuite/data/.*

- name: Set up Python
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
VALIDATE_BASH_EXEC: true
# VALIDATE_CSS: true
# VALIDATE_DOCKER: true
VALIDATE_EDITORCONFIG: true
VALIDATE_JAVASCRIPT_ES: true
# VALIDATE_JAVASCRIPT_STANDARD: true
VALIDATE_JSON: true
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@ repos:
rev: v1.35.1
hooks:
- id: yamllint
# TODO: In a next release, the plain editorconfig-checker repo could be used
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 3.2.0
hooks:
- id: editorconfig-checker
alias: ec
4 changes: 2 additions & 2 deletions db/drivers/mysql/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ endif

include $(MODULE_TOPDIR)/include/Make/DB.make

LIBES = $(DBMIDRIVERLIB) $(DBMIBASELIB) $(DBSTUBSLIB) \
$(GISLIB) $(DATETIMELIB)
LIBES = $(DBMIDRIVERLIB) $(DBMIBASELIB) $(DBSTUBSLIB) \
$(GISLIB) $(DATETIMELIB)
EXTRA_CFLAGS = $(MYSQLINCPATH)
EXTRA_LDFLAGS = $(MYSQLLIBPATH)

Expand Down
Loading
Loading