Skip to content

Commit

Permalink
SCP-140 Adds UX into copyleft policy report
Browse files Browse the repository at this point in the history
  • Loading branch information
francostramana committed Feb 26, 2024
1 parent e15c5a9 commit 9a5bed2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
4 changes: 0 additions & 4 deletions __tests__/result-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,9 @@ describe('Test components service', () => {
it(`test c`, () => {

Check warning on line 66 in __tests__/result-service.test.ts

View workflow job for this annotation

GitHub Actions / TypeScript Tests

Test has no assertions

Check warning on line 66 in __tests__/result-service.test.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

Test has no assertions
const scannerResults = JSON.parse(t.content) as ScannerResults;
const components = getComponents(scannerResults);
const util = require('util');
// console.log(util.inspect(compoments, {showHidden: false, depth: null, colors: true}))

const componentsWithCopyleft = components.filter(component =>

Check warning on line 70 in __tests__/result-service.test.ts

View workflow job for this annotation

GitHub Actions / TypeScript Tests

'componentsWithCopyleft' is assigned a value but never used

Check warning on line 70 in __tests__/result-service.test.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

'componentsWithCopyleft' is assigned a value but never used
component.licenses.some(license => !!license.copyleft)
);

console.log(util.inspect(componentsWithCopyleft, { showHidden: false, depth: null, colors: true }));
});
});
10 changes: 5 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/policies/copyleft-policy-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ScannerResults } from '../services/result.interfaces';
import { CHECK_NAME } from '../app.config';
import { PolicyCheck } from './policy-check';
import { Component, getComponents, getLicenses } from '../services/result.service';

Check warning on line 4 in src/policies/copyleft-policy-check.ts

View workflow job for this annotation

GitHub Actions / TypeScript Tests

'getLicenses' is defined but never used

Check warning on line 4 in src/policies/copyleft-policy-check.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

'getLicenses' is defined but never used
import { generateTable } from 'src/utils/markdown.util';
import { generateTable } from '../utils/markdown.utils';

export class CopyleftPolicyCheck extends PolicyCheck {
constructor() {
Expand Down Expand Up @@ -30,8 +30,8 @@ export class CopyleftPolicyCheck extends PolicyCheck {

private getSummary(components: Component[]): string {
return components.length === 0
? '### :white_check_mark: Policy Pass \n ' + '#### ' + 'Not copyleft components were found'
: '### :x: Policy Fail \n' + '#### ' + components.length + ' component(s) with copyleft licenses were found';
? '### :white_check_mark: Policy Pass \n #### Not copyleft components were found'
: `### :x: Policy Fail \n #### ${components.length} component(s) with copyleft licenses were found. \n See details for more information.`;
}

private getDetails(components: Component[]): string {
Expand Down
File renamed without changes.

0 comments on commit 9a5bed2

Please sign in to comment.