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

build: add repo-health-job script #349

Merged
merged 3 commits into from
Mar 6, 2023

Conversation

UsamaSadiq
Copy link
Member

Description

Added the repo-health-script in this repo to make it accessible to the new repo health job workflow for execution.
For further details on this change, see the discussion on the PR openedx/.github#52.

@codecov
Copy link

codecov bot commented Feb 22, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (d5ea934) 83.23% compared to head (641611b) 83.23%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #349   +/-   ##
=======================================
  Coverage   83.23%   83.23%           
=======================================
  Files          21       21           
  Lines        1163     1163           
=======================================
  Hits          968      968           
  Misses        195      195           
Flag Coverage Δ
unittests 83.23% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
repo_health/utils.py 94.33% <0.00%> (ø)
repo_health/__init__.py 62.50% <0.00%> (ø)
repo_health/check_docs.py 86.41% <0.00%> (ø)
repo_health/check_readme.py 73.07% <0.00%> (ø)
repo_health/check_tox_ini.py 100.00% <0.00%> (ø)
repo_health/check_makefile.py 94.28% <0.00%> (ø)
repo_health/check_setup_py.py 81.63% <0.00%> (ø)
repo_health/check_existence.py 100.00% <0.00%> (ø)
repo_health/check_travis_yml.py 83.60% <0.00%> (ø)
repo_health/check_ubuntufiles.py 86.02% <0.00%> (ø)
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@UsamaSadiq
Copy link
Member Author

Hi @nedbat
I've tried addressing most of your concerns and reviews on the script. Please have a look at it in detail. Thanks.

@nedbat
Copy link
Contributor

nedbat commented Feb 23, 2023

I ran this file through https://shellcheck.net:

[Line 11:](javascript:setPosition(11, 7))
if [[ ! -z $REPORT_DATE ]]; then REPORT_DATE=$(date '+%Y-%m-%d' -d "$REPORT_DATE"); fi
      ^-- [SC2236](https://www.shellcheck.net/wiki/SC2236) (style): Use -n instead of ! -z.
 
[Line 19:](javascript:setPosition(19, 4))
cd $WORKSPACE
   ^-- [SC2086](https://www.shellcheck.net/wiki/SC2086) (info): Double quote to prevent globbing and word splitting.

Did you mean: ([apply this](javascript:applyFixIndex([1])), apply [all SC2086](javascript:applyFixCode(2086)))
cd "$WORKSPACE"
 
[Line 21:](javascript:setPosition(21, 17))
for ORG_NAME in ${ORG_NAMES[@]}; do
                ^-- [SC2068](https://www.shellcheck.net/wiki/SC2068) (error): Double quote array expansions to avoid re-splitting elements.
                ^-- [SC2153](https://www.shellcheck.net/wiki/SC2153) (info): Possible misspelling: ORG_NAMES may not be assigned. Did you mean ORG_NAME?
 
[Line 45:](javascript:setPosition(45, 1))
COUNTER=0
^-- [SC2034](https://www.shellcheck.net/wiki/SC2034) (warning): COUNTER appears unused. Verify use (or export if used externally).
 
[Line 47:](javascript:setPosition(47, 8))
    cd $WORKSPACE
       ^-- [SC2086](https://www.shellcheck.net/wiki/SC2086) (info): Double quote to prevent globbing and word splitting.

Did you mean: ([apply this](javascript:applyFixIndex([5])), apply [all SC2086](javascript:applyFixCode(2086)))
    cd "$WORKSPACE"
 
[Line 79:](javascript:setPosition(79, 11))
    if [[ ! -z $REPORT_DATE ]]; then
          ^-- [SC2236](https://www.shellcheck.net/wiki/SC2236) (style): Use -n instead of ! -z.
 
[Line 83:](javascript:setPosition(83, 26))
            git checkout `git rev-list -n 1 --before="${REPORT_DATE} 00:00" master`
                         ^-- [SC2046](https://www.shellcheck.net/wiki/SC2046) (warning): Quote this to prevent word splitting.
                         ^-- [SC2006](https://www.shellcheck.net/wiki/SC2006) (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: ([apply this](javascript:applyFixIndex([8])), apply [all SC2006](javascript:applyFixCode(2006)))
            git checkout $(git rev-list -n 1 --before="${REPORT_DATE} 00:00" master)
 
[Line 98:](javascript:setPosition(98, 30))
          --repo-health-path ${WORKSPACE}/edx-repo-health \
                             ^-- [SC2086](https://www.shellcheck.net/wiki/SC2086) (info): Double quote to prevent globbing and word splitting.

Did you mean: ([apply this](javascript:applyFixIndex([9])), apply [all SC2086](javascript:applyFixCode(2086)))
          --repo-health-path "${WORKSPACE}"/edx-repo-health \
 
[Line 99:](javascript:setPosition(99, 23))
          --repo-path ${WORKSPACE}/target-repo \
                      ^-- [SC2086](https://www.shellcheck.net/wiki/SC2086) (info): Double quote to prevent globbing and word splitting.

Did you mean: ([apply this](javascript:applyFixIndex([10])), apply [all SC2086](javascript:applyFixCode(2086)))
          --repo-path "${WORKSPACE}"/target-repo \
 
[Line 122:](javascript:setPosition(122, 19))
failed_repo_names=$(echo "${failed_repos[*]}")
                  ^-- [SC2116](https://www.shellcheck.net/wiki/SC2116) (style): Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.
 
[Line 123:](javascript:setPosition(123, 17))
for ORG_NAME in ${ORG_NAMES[@]}; do
                ^-- [SC2068](https://www.shellcheck.net/wiki/SC2068) (error): Double quote array expansions to avoid re-splitting elements.
 
[Line 141:](javascript:setPosition(141, 14))
    if [[ ! "${failed_repos}" ]]; then
             ^-- [SC2128](https://www.shellcheck.net/wiki/SC2128) (warning): Expanding an array without an index only gives the first element.
 
[Line 155:](javascript:setPosition(155, 36))
    git config --global user.email ${GITHUB_USER_EMAIL}
                                   ^-- [SC2086](https://www.shellcheck.net/wiki/SC2086) (info): Double quote to prevent globbing and word splitting.

Did you mean: ([apply this](javascript:applyFixIndex([14])), apply [all SC2086](javascript:applyFixCode(2086)))
    git config --global user.email "${GITHUB_USER_EMAIL}"
 
[Line 156:](javascript:setPosition(156, 50))
    git diff-index --quiet HEAD || git commit -m ${commit_message}
                                                 ^-- [SC2086](https://www.shellcheck.net/wiki/SC2086) (info): Double quote to prevent globbing and word splitting.

Did you mean: ([apply this](javascript:applyFixIndex([15])), apply [all SC2086](javascript:applyFixCode(2086)))
    git diff-index --quiet HEAD || git commit -m "${commit_message}"

Copy link
Contributor

@nedbat nedbat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more opportunities to make this more uniform.

scripts/repo-health-script.sh Outdated Show resolved Hide resolved
scripts/repo-health-script.sh Outdated Show resolved Hide resolved
scripts/repo-health-script.sh Outdated Show resolved Hide resolved
scripts/repo-health-script.sh Outdated Show resolved Hide resolved
scripts/repo-health-script.sh Outdated Show resolved Hide resolved
scripts/repo-health-script.sh Outdated Show resolved Hide resolved
scripts/repo-health-script.sh Outdated Show resolved Hide resolved
@UsamaSadiq UsamaSadiq merged commit 8589a92 into master Mar 6, 2023
@UsamaSadiq UsamaSadiq deleted the usamasadiq/add-repo-health-job-script branch March 6, 2023 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants