repolinter icon indicating copy to clipboard operation
repolinter copied to clipboard

Lint function does not accept a git URL

Open discombobulateme opened this issue 3 years ago • 2 comments

Issue Report

When using repolinter as a dependency, I do not receive the lint.results

Expected Behavior

  1. To receive all tests passed using default ruleset after running lint.results
  2. To receive the same results as when running repolinter in bash

GitHub repository used as a model repository tested: Sauce Labs OSPO new project template

Actual Behavior

Receive status: 'NOT_PASSED_ERROR', passed: false

Screen Shot 2020-10-26 at 6 39 37 PM

Steps to Reproduce the Issue

  1. Use repolinter in bash: repolinter lint -g https://github.com/saucelabs/new-project.git
  2. Use repolinter as a dependency in a node project npm i repolinter
  3. Import it into a file
const repolinter = require('repolinter')

async function main() {
 
  const url = 'https://github.com/saucelabs/new-project.git'

  const repolinterConnect = await repolinter.lint(url)
  console.log(repolinterConnect.results)

  const results = repolinterConnect.results
    .filter(r => r.lintResult && !r.lintResult.passed)
    .map(r => r.lintResult.message)
  // console.log(`In the repo ${url} there are a few missing things: ${results}\n`)
}

main()
  1. run file node <file-name>.js
  2. compare results

discombobulateme avatar Oct 26 '20 17:10 discombobulateme

This is because the lint API does not accept a URL, but the CLI does. If you would like to use the lint API on a git repository, I would recommend cloning the repository locally and then using the lint function on the cloned directory. This functionality is actually implemented in the CLI here: https://github.com/todogroup/repolinter/blob/080524e48d60f211895c3d7271133a4f2f9bf3c4/bin/repolinter.js#L94-L106

prototypicalpro avatar Oct 26 '20 19:10 prototypicalpro

Thank you for your super fast feedback! :)

discombobulateme avatar Oct 26 '20 19:10 discombobulateme