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 #310

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .cppcheck-suppressions
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ syntaxError:display/displaydrivers.html
# dist.x86_64-pc-linux-gnu
syntaxError:dist.x86_64-pc-linux-gnu/*

# doc
# doc
syntaxError:doc/*

# docker
Expand All @@ -51,7 +51,7 @@ negativeIndex:imagery/i.atcorr/computations.cpp:1025
syntaxError:include/Makefile
syntaxError:include/VERSION:1

# text files
# text files
syntaxError:INSTALL.md
syntaxError:install-sh
syntaxError:GPL.TXT
Expand Down Expand Up @@ -131,7 +131,7 @@ syntaxError:mswindows/*
invalidFunctionArg:raster/r.sim/simlib/random.c:36
invalidFunctionArg:raster/r.sim/simlib/random.c:57

## Different rules under different ifdef.
## Different rules under different ifdef.
ctuOneDefinitionRuleViolation:raster/r.in.pdal/grassrasterwriter.h:39
syntaxError:raster/rasterintro.html
syntaxError:raster/Makefile:155
Expand Down
123 changes: 123 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# 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

# TODO: Remove R batch files exclusions once fixed
[mswindows/external/rbatch/*]
trim_trailing_whitespace = unset
end_of_line = unset
charset = unset
insert_final_newline = unset

# 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
2 changes: 1 addition & 1 deletion .github/actions/create-upload-suggestions/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ runs:
env:
FORMATTED_URL: >-
[`formatted-${{ steps.tool-name-safe.outputs.tool-name }}`](${{
steps.upload-changes.outputs.artifact-url }})
steps.upload-changes.outputs.artifact-url }})
- name: Fail action if some files were changed
if: >-
${{ (steps.files_changed.outputs.files_changed == 'true') &&
Expand Down
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 @@ -36,12 +36,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@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
--min-success 100 --config .github/workflows/macos_gunittest.cfg
env:
SampleData: "https://grass.osgeo.org/sampledata/north_carolina/\
nc_spm_full_v2alpha2.tar.gz"
nc_spm_full_v2alpha2.tar.gz"
- name: Make HTML test report available
if: ${{ !cancelled() }}
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
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 @@ -49,6 +49,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 @@ -78,3 +78,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.0.3
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
26 changes: 13 additions & 13 deletions include/Make/Install.make
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ $(DESTDIR)$(INST_DIR) $(DESTDIR)$(UNIX_BIN):

$(STARTUP): $(ARCH_DISTDIR)/$(GRASS_NAME).tmp
sed -e 's#'@GISBASE@'#'$(INST_DIR)'#g' \
-e 's#'@LD_LIBRARY_PATH_VAR@'#'$(LD_LIBRARY_PATH_VAR)'#g' \
-e 's#'@CONFIG_PROJSHARE@'#'$(PROJSHARE)'#g' \
$< > $@
-e 's#'@LD_LIBRARY_PATH_VAR@'#'$(LD_LIBRARY_PATH_VAR)'#g' \
-e 's#'@CONFIG_PROJSHARE@'#'$(PROJSHARE)'#g' \
$< > $@
-$(CHMOD) a+x $@

define fix_gisbase
Expand Down Expand Up @@ -173,16 +173,16 @@ BINDISTNAME = grass-$(GRASS_VERSION_NUMBER)-$(ARCH)-$(DATE)
real-bindist:
-tar cCBf $(ARCH_DISTDIR) - $(BIN_DIST_FILES) | gzip -fc > $(BINDISTNAME).tar.gz
-size=`ls -l $(BINDISTNAME).tar.gz | awk '{print $$5}'`; \
sed -e "s/BIN_DIST_VERSION/$(GRASS_VERSION_NUMBER)-$(ARCH)-$(DATE)/" \
-e "s/GRASSPRG_NAME/$(GRASS_NAME)/" \
-e "s/SIZE_TAR_FILE/$$size/" -e "s#BIN_DIST_DIR#'$(INST_DIR)'#" \
-e "s/ARCHITECTURE/$(ARCH)/" \
-e "s/LD_LIBRARY_PATH_VAR/$(LD_LIBRARY_PATH_VAR)/" \
-e "s/TEST_STR=/TEST_STR=executable/" \
-e "s#IMPORTANT.*#Generated from the binaryInstall.src file using the command make bindist#" \
-e "s/# executable shell.*//" -e "s/# make bindist.*//" \
binaryInstall.src > $(BINDISTNAME)-install.sh ; \
chmod a+x $(BINDISTNAME)-install.sh 2>/dev/null
sed -e "s/BIN_DIST_VERSION/$(GRASS_VERSION_NUMBER)-$(ARCH)-$(DATE)/" \
-e "s/GRASSPRG_NAME/$(GRASS_NAME)/" \
-e "s/SIZE_TAR_FILE/$$size/" -e "s#BIN_DIST_DIR#'$(INST_DIR)'#" \
-e "s/ARCHITECTURE/$(ARCH)/" \
-e "s/LD_LIBRARY_PATH_VAR/$(LD_LIBRARY_PATH_VAR)/" \
-e "s/TEST_STR=/TEST_STR=executable/" \
-e "s#IMPORTANT.*#Generated from the binaryInstall.src file using the command make bindist#" \
-e "s/# executable shell.*//" -e "s/# make bindist.*//" \
binaryInstall.src > $(BINDISTNAME)-install.sh ; \
chmod a+x $(BINDISTNAME)-install.sh 2>/dev/null

bindist-macosx:
$(MAKE) -C macosx bindist-macosx
Expand Down
2 changes: 1 addition & 1 deletion lib/fonts/fonts/cyrilc.hmp
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
2801 2802 2823 2805 2806 2821 2804 2822
2809 2810 2811 2812 2813 2814 2815 2816
2832 2817 2818 2819 2820 2807 2803 2829
2828 2808 2825 2830 2826 2824 2827 2832
2828 2808 2825 2830 2826 2824 2827 2832
6 changes: 3 additions & 3 deletions lib/fonts/fonts/fonts.table
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#
# Descriptive Names for GRASS Stroke Fonts
#
# This file maps a descriptive name to each font file, for use in the
# This file maps a descriptive name to each font file, for use in the
# description field in the fontcap table (generated by g.mkfontcap).
#
# Format: Each line contains the filename followed by the vertical bar
# character | and then the descriptive name.
#
# Note that this file is used purely for the purpose of specifying
# Note that this file is used purely for the purpose of specifying
# descriptive names for the Stroke fonts in this directory.
# $GISBASE/etc/fontcap contains the list of fonts available to the GRASS
# display drivers, and any changes must be reflected there before they are
# display drivers, and any changes must be reflected there before they are
# available for use - g.mkfontcap can do this automatically.
#
cyrilc.hmp|Cyrillic
Expand Down
34 changes: 17 additions & 17 deletions man/sphinx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ json:
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/grass_gis.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/grass_gis.qhc"
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/grass_gis.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/grass_gis.qhc"

devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
Expand All @@ -98,9 +98,9 @@ epub:
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
Expand All @@ -121,9 +121,9 @@ man:
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."

info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
Expand All @@ -144,10 +144,10 @@ changes:
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."

doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
Loading
Loading