@@ -40,35 +40,33 @@ jobs:
4040 run : /usr/bin/sudo apt-get -y install coccinelle
4141 - name : Lint
4242 run : |
43- linter_env = new.env()
44- for (f in list.files('.ci/linters/c', full.names=TRUE)) sys.source(f, linter_env)
45- for (f in list.files('src', pattern='[.][ch]$', full.names=TRUE)) {
46- c_obj = list(path = f, lines = readLines(f))
47- c_obj$preprocessed = system2( "gcc", c("-fpreprocessed", "-E", f), stdout=TRUE, stderr=FALSE)
48- for (linter in ls(linter_env)) linter_env[[linter]](c_obj)
49- # TODO(#6272): Incorporate more checks from CRAN_Release
50- }
51- shell : Rscript {0}
43+ Rscript .ci/lint.R .ci/linters/c src '[.][ch]$' '
44+ function (f) list(
45+ c_obj = f, lines = readLines(f),
46+ preprocessed = system2(
47+ "gcc", shQuote( c("-fpreprocessed", "-E", f)),
48+ stdout = TRUE, stderr = FALSE
49+ )
50+ )
51+ '
5252 lint-po :
5353 runs-on : ubuntu-latest
5454 steps :
5555 - uses : actions/checkout@v4
5656 - uses : r-lib/actions/setup-r@v2
5757 - name : Check translations
58+ # only pay attention to files edited in the current PR, otherwise we can get
59+ # a situation like after #6424 where some untranslated messages were added
60+ # as part of non-translation maintenance, but this GHA would go red repeatedly
61+ # until a translation is added or the blank/fuzzy translations removed. We'd
62+ # rather only have the failure on one PR, then ignore these files later.
5863 run : |
59- linter_env = new.env()
60- for (f in list.files('.ci/linters/po', full.names=TRUE)) sys.source(f, linter_env)
61- for (po_file in list.files(pattern = "[.]po$", full.names=TRUE)) {
62- # only pay attention to files edited in the current PR, otherwise we can get
63- # a situation like after #6424 where some untranslated messages were added
64- # as part of non-translation maintenance, but this GHA would go red repeatedly
65- # until a translation is added or the blank/fuzzy translations removed. We'd
66- # rather only have the failure on one PR, then ignore these files later.
67- diff_v_master = system2("git", c("diff", "master", po_file), stdout=TRUE)
68- if (!length(diff_v_master)) next
69- for (linter in ls(linter_env)) linter_env[[linter]](po_file)
70- }
71- shell : Rscript {0}
64+ Rscript .ci/lint.R .ci/linters/po po '[.]po$' "
65+ function (f) {
66+ diff_v_master = system2('git', c('diff', 'master', f), stdout=TRUE)
67+ if (length(diff_v_master)) f
68+ }
69+ "
7270 lint-md :
7371 runs-on : ubuntu-latest
7472 steps :
0 commit comments