Skip to content

Commit

Permalink
ci: add static analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
tompsota committed Nov 8, 2024
1 parent c3710c5 commit 27fd5d6
Show file tree
Hide file tree
Showing 22 changed files with 3,524 additions and 3,122 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/**/plugins/
26 changes: 26 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
},
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
settings: {
react: {
version: 'detect',
},
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
},
};
9 changes: 0 additions & 9 deletions .eslintrc.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Setup
description: Setup Node.js and install dependencies

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
node-version-file: .nvmrc

- name: Install dependencies
run: |
npm ci
npm ci --prefix example
shell: bash
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI
on:
push:
branches:
- master
paths-ignore:
- '**/*.md'
- '.github/**'
pull_request:
branches:
- master
paths-ignore:
- '**/*.md'
- '.github/**'

jobs:
static-analysis:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Lint files
run: npm run eslint -- --max-warnings=0

- name: Typecheck files
run: npm run typecheck

- name: Format check
run: npm run prettier -- --check

build:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
example/www
example/plugins
example/platforms
example/dist
4 changes: 0 additions & 4 deletions example/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
"project": ["tsconfig.json"],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
Expand Down
13 changes: 5 additions & 8 deletions example/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
jasmine: {
Expand All @@ -19,18 +19,15 @@ module.exports = function (config) {
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
suppressAll: true, // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/app'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
reporters: [{ type: 'html' }, { type: 'text-summary' }],
},
reporters: ['progress', 'kjhtml'],
port: 9876,
Expand All @@ -39,6 +36,6 @@ module.exports = function (config) {
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
});
};
2 changes: 1 addition & 1 deletion example/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
</ion-header>

<ion-content>
<freerasp-demo [checks]="appChecks"></freerasp-demo>
<app-freerasp-demo [checks]="appChecks"></app-freerasp-demo>
</ion-content>
</ion-app>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1>freeRASP checks:</h1>
</ion-label>

@if (check.name === 'Malware' && !check.isSecure) {
<malware-modal />
<app-malware-modal />
}

<ion-icon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, Input } from '@angular/core';
import { shieldCheckmarkOutline, alertCircleOutline } from 'ionicons/icons';

@Component({
selector: 'freerasp-demo',
selector: 'app-freerasp-demo',
templateUrl: './freerasp-demo.component.html',
styleUrls: ['./freerasp-demo.component.css'],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { SuspiciousAppInfo } from 'cordova-talsec-plugin-freerasp';
declare var talsec: any;

@Component({
selector: 'malware-item',
selector: 'app-malware-item',
templateUrl: './malware-item.component.html',
styleUrls: ['./malware-item.component.css', '../../../theme/variables.css'],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
<ion-list lines="none">
@for (susApp of suspiciousApps; track $index) {
<ion-item>
<malware-item class="fullWidth" [susApp]="susApp"></malware-item>
<app-malware-item
class="fullWidth"
[susApp]="susApp"
></app-malware-item>
</ion-item>
}
</ion-list>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Subscription } from 'rxjs';
import { SuspiciousAppInfo } from 'cordova-talsec-plugin-freerasp';

@Component({
selector: 'malware-modal',
selector: 'app-malware-modal',
templateUrl: './malware-modal.component.html',
styleUrls: ['./malware-modal.component.css'],
})
Expand Down
2 changes: 1 addition & 1 deletion example/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const environment = {
production: true
production: true,
};
2 changes: 1 addition & 1 deletion example/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// The list of file replacements can be found in `angular.json`.

export const environment = {
production: false
production: false,
};

/*
Expand Down
5 changes: 3 additions & 2 deletions example/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';

platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.log(err));
5 changes: 2 additions & 3 deletions example/src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@
* (window as any).__Zone_enable_cross_context_check = true;
*
*/

import './zone-flags';

/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js'; // Included with Angular CLI.

import 'zone.js'; // Included with Angular CLI.

/***************************************************************************************************
* APPLICATION IMPORTS
Expand Down
Loading

0 comments on commit 27fd5d6

Please sign in to comment.