Package: nittymcpick
nittymcpickYour friendly nitpicking GitLab botPurposeThis bot does run custom linting tools on receiving a webhook from
GitLab and reporting back its findings as comments to the merge request
diffPrerequisitespython 3.6+GitLab CE/EESetupInstall tool to a machineThis machine has to be reachable by the GitLab server via network. In
the following we will assume a local installation on the GitLab Server
itself (127.0.0.1)Install via pypipip3installnittymcpickCreate a GitLab userGo to GitLab with an account that can create users (e.g.root)admin/users/newName= Nitty McPickUsername= nittymcpickEmail=foo@localhost(or any other non-exisiting mail
address)Access Level= Regularadmin/users/nittymcpick/impersonation_tokensName= e.g. Nitty McPick BotScopes=api,read_repositoryIMPORTANTcopy the content ofYour New Impersonation
TokenAdd bot to the projectGoto Gitlab with an account that can change project settings[username]/[project]/-project_members/searchNitty McPickat **GitLabd member or Email address*clickInviteChange levelNitty McPickfromGuesttoReporterCreate a GitLab webhookGoto Gitlab with an account that can change project settings**[username]/[project]/-/settings/integrationsURL:http://127.0.0.1:8888Trigger: Merge requests eventsSSL verification: uncheck the boxClick onAdd webhookCreate a configuration for the botCreate a json file like shown atconfig.json.sample. The file can contain any
number of itemslintersectionattributedescriptionnamename of the linting toolpathabsolute path of binary of the linting toolargslist of additional arguments to be passed to the linterret_regexregular expression for evaluation of the output of the
linter (seeReturn Regex)tweaks.lin
e_count_ad
justAdd number of lines to the reported output line numbertweaks.sin
gle_file_e
xecRun each matching file in a single linter instance,
otherwise all files will be run by a single instancematchessectionattributedescriptionpatternRegular expression for files that should be checkedReturn RegexThe regular expression to extract all the needed data should contain the
following named groupsseverity- for the severity of the finding (optional)line- Line where the findings occuredmessage- A meaningful messagefile- The file where the of the findingRun the toolusage: nittymcpick [-h] [--token TOKEN] [--onlynew] [--nowip] [--host HOST]
                   [--port PORT] [--botname BOTNAME]
                   config

Your friendly linting bot for gitlab

positional arguments:
  config             config file

optional arguments:
  -h, --help         show this help message and exit
  --token TOKEN      Access token to use (default:GL_ACCESS_TOKEN from
                     environment)
  --onlynew          Comment only on changes (default:false)
  --nowip            Ignore WIP merge requests (default:false)
  --host HOST        IP to bind to (default:127.0.0.1)
  --port PORT        Port to bind to (default:8888)
  --botname BOTNAME  Username of the bot in GitLab
                     (default:NITTY_MCPICK_USERNAME from env or 'nittymcpick')e.g. runexportGL_ACCESS_TOKEN=<ImpersonationTokenfromgitlab>nittymcpickconfig.jsonnow everytime a merge request is opened or changed the tool will run all
the configured linting tools. On a finding it would comment directly to
the MR like thisNitty McPick @nittymcpick · just now
Reporter

mytool found a potential error - the code is absolutely insecureDockerThere is an already prepared container available underprivkweihmann/nittymcpick:latestA word on securityIt is heavily advised to run the bot on the gitlab server itself, as
currently onlyhttp://as a webhook protocol is supported.PRs to enablehttps://as welcome!