BioDT / biodt-shiny

This repository contains a shiny application which is intended as the simplest way of interacting with BioDT by end-users.
Other
4 stars 2 forks source link

[TESTS] fix various errors and similar wrong-doers in GH Actions' jobs (aka CI/CD pipelines) #115

Open osalamon opened 2 weeks ago

osalamon commented 2 weeks ago

Why not to utilize capabilities of GH's Actions, when they are here and available...

Lint R

:ok_hand: The correct look of this workflow job/step might look like this. (Stolen from Appsilon's open source repo, app "LogAnalyzer").

Run rhino::lint_r()
  rhino::lint_r()
  shell: /usr/local/bin/Rscript {0}
  env:
    R_LIBS_USER: /home/runner/work/_temp/Library
    TZ: UTC
    _R_CHECK_SYSTEM_CLOCK_: FALSE
    NOT_CRAN: true
    RENV_PATHS_ROOT: /home/runner/work/_temp/renv
✔ No style errors found.

:shit: Our app, the same run.

Run rhino::lint_r()
  rhino::lint_r()
  shell: /usr/local/bin/Rscript {0}
  env:
    R_LIBS_USER: /home/runner/work/_temp/Library
    TZ: UTC
    _R_CHECK_SYSTEM_CLOCK_: FALSE
    NOT_CRAN: true
    RENV_PATHS_ROOT: /home/runner/work/_temp/renv
Error: Error: Malformed config file, ensure it ends in a newline
  Malformed config setting 'linters'
  'box_func_import_count_linter' is not an exported object from 'namespace:rhino'
Execution halted
Error: Process completed with exit code 1.```

Lint JavaScript

:ok_hand:

Run rhino::lint_js()
  rhino::lint_js()
  shell: /usr/local/bin/Rscript {0}
  env:
    R_LIBS_USER: /home/runner/work/_temp/Library
    TZ: UTC
    _R_CHECK_SYSTEM_CLOCK_: FALSE
    NOT_CRAN: true
    RENV_PATHS_ROOT: /home/runner/work/_temp/renv
ℹ Initializing Node.js directory...
ℹ Installing Node.js packages with npm...

added 760 packages in 16s

> lint-js
> eslint --config .eslintrc.json ../app/js

:shit: Our app.

Run rhino::lint_js()
  rhino::lint_js()
  shell: /usr/local/bin/Rscript {0}
  env:
    R_LIBS_USER: /home/runner/work/_temp/Library
    TZ: UTC
    _R_CHECK_SYSTEM_CLOCK_: FALSE
    NOT_CRAN: true
    RENV_PATHS_ROOT: /home/runner/work/_temp/renv
ℹ Initializing Node.js directory...
ℹ Installing Node.js packages with npm...

added 761 packages in 17s

> lint-js
> eslint --config .eslintrc.json ../app/js

So far ok... but it's followed by a plenty of red errors. To name just few:

home/runner/work/biodt-shiny/biodt-shiny/app/js/popover.js
Error:   2:3   error    There should be no space after this paren         space-in-parens
Error:   2:21  error    Unexpected function expression                    prefer-arrow-callback
Error:   2:32  error    Block must not be padded by blank lines           padded-blocks
Error:   4:3   error    Unexpected var, use let or const instead          no-var
Error:   4:98  error    Missing semicolon                                 semi
Error:   5:7   error    'popoverList' is assigned a value but never used  no-unused-vars
Error:   6:1   error    Expected indentation of 4 spaces but found 2      indent
Error:   6:14  error    'bootstrap' is not defined                        no-undef
Error:   6:49  error    Missing semicolon                                 semi
Error:   7:5   error    Block must not be padded by blank lines           padded-blocks
Error:   8:1   error    Trailing spaces not allowed                       no-trailing-spaces
Error:    8:58  error    Expected parentheses around arrow function argument           arrow-parens
Error:    9:1   error    Expected indentation of 4 spaces but found 6                  indent
Error:    9:41  error    Multiple spaces found before '// Sub nav tab...'              no-multi-spaces
Error:   10:8   error    Block must not be padded by blank lines                       padded-blocks
Error:   14:1   error    Expected exception block, space or tab after '/*' in comment  spaced-comment
Error:   14:1   error    Expected space or tab before '*/' in comment                  spaced-comment
[AND MANY OTHERS...]

Final summary:

✖ 37 problems (34 errors, 3 warnings)
  32 errors and 0 warnings potentially fixable with the `--fix` option.

Error in `node_run()`:
! System command 'npm' exited with status 1.
Backtrace:
    ▆
 1. └─rhino::lint_js()
 2.   └─rhino:::npm("run", "lint-js")
 3.     └─rhino:::node_run(npm_command, ...)
 4.       └─cli::cli_abort("System command '{command}' exited with status {status}.")
 5.         └─rlang::abort(...) at cli/R/rlang.R:45:3
Execution halted
Error: Process completed with exit code 1.

Lint Sass

:ok_hand:

Run rhino::lint_sass()
  rhino::lint_sass()
  shell: /usr/local/bin/Rscript {0}
  env:
    R_LIBS_USER: /home/runner/work/_temp/Library
    TZ: UTC
    _R_CHECK_SYSTEM_CLOCK_: FALSE
    NOT_CRAN: true
    RENV_PATHS_ROOT: /home/runner/work/_temp/renv

> lint-sass
> stylelint ../app/styles

:shit: Vs. our app:

Run rhino::lint_sass()
  rhino::lint_sass()
  shell: /usr/local/bin/Rscript {0}
  env:
    R_LIBS_USER: /home/runner/work/_temp/Library
    TZ: UTC
    _R_CHECK_SYSTEM_CLOCK_: FALSE
    NOT_CRAN: true
    RENV_PATHS_ROOT: /home/runner/work/_temp/renv

> lint-sass
> stylelint ../app/styles

[MANY MANY ISSUES OD MINOR IMPORTANCE FOLLOWS:]
../app/styles/main.scss
   6:5   ✖  Expected indentation of 2 spaces                                    indentation
  10:1   ✖  Expected class selector ".card_title" to be kebab-case              selector-class-pattern
  11:5   ✖  Expected "0.25rem 0 0.25rem 0" to be "0.25rem 0"                    shorthand-property-no-redundant-values
  11:5   ✖  Expected indentation of 2 spaces                                    indentation
  12:5   ✖  Expected indentation of 2 spaces                                    indentation
  15:1   ✖  Expected class selector ".pdt_instructions_title" to be kebab-case  selector-class-pattern
  20:10  ✖  Expected "#414F2F" to be "#414f2f"                                  color-hex-case
  25:22  ✖  Expected single space after ">"                                     selector-combinator-space-after
  25:22  ✖  Expected single space before ">"                                    selector-combinator-space-before
  50:40  ✖  Expected "0.5" to be "50%"                                          alpha-value-notation
  53:23  ✖  Expected modern color-function notation                             color-function-notation
  54:23  ✖  Expected modern color-function notation                             color-function-notation
  54:41  ✖  Expected "0.6" to be "60%"                                          alpha-value-notation
  55:12  ✖  Expected modern color-function notation                             color-function-notation
 253:1   ✖  Expected no more than 1 empty line                                  max-empty-lines

62 problems (62 errors, 0 warnings)

Error in `node_run()`:
! System command 'npm' exited with status 2.
Backtrace:
    ▆
 1. └─rhino::lint_sass()
 2.   └─rhino:::npm("run", "lint-sass")
 3.     └─rhino:::node_run(npm_command, ...)
 4.       └─cli::cli_abort("System command '{command}' exited with status {status}.")
 5.         └─rlang::abort(...) at cli/R/rlang.R:45:3
Execution halted
Error: Process completed with exit code 1.
osalamon commented 2 weeks ago

Also compare the rest I haven't time to put it here. Ie.:

:ok_hand: https://github.com/Appsilon/LogAnalyzer/actions/runs/10864420919/job/30149676840

vs.

:shit: https://github.com/BioDT/biodt-shiny/actions/runs/11684914332/job/32537176555