Skip to content

Commit

Permalink
use gitattributes to handle this instead of GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico committed Aug 20, 2024
1 parent feb0114 commit 9eba7e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
7 changes: 3 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
* -text
* text=auto
*.Rraw linguist-language=R

* text eol=lf
inst/tests/** -text
inst/tests/*.Rraw text eol=lf linguist-language=R
25 changes: 0 additions & 25 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,3 @@ jobs:
- name: Lint
run: for (f in list.files('.ci/linters/md', full.names=TRUE)) source(f)
shell: Rscript {0}
lint-misc:
runs-on: ubuntu-latest
steps:
- name: Don't auto-convert line endings during checkout step
run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- name: Lint line endings
run: |
for (f in list.files(recursive = TRUE)) {
if (basename(f) %in% c("CODEOWNERS", "R-es.po", "es.po")) {
nchar = sum(nchar(readLines(f, n=3L))) + 6 # padding for line endings
str = readChar(f, nchar)
cat(sprintf("Here's the first %d characters of %s\n\n%s\n", nchar, f, encodeString(str)))
}
# tryCatch() here are to skip binary/plaintext files (e.g. csv)
ch <- tryCatch(readChar(f, file.size(f)), condition=identity)
if (inherits(ch, "condition")) next
nch <- tryCatch(nchar(ch), condition=identity)
if (inherits(nch, "condition")) next
if (grepl("\r", ch, fixed = TRUE)) {
stop("Line ending \\r found in ", f, ", please stick with \\n only.")
}
}
shell: Rscript {0}

0 comments on commit 9eba7e5

Please sign in to comment.