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

Adding new checkup package to provide plugin utils. Generates docs #923

Merged
merged 1 commit into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: Adding new checkup package to provide plugin utils. Generates d…
…ocs.
  • Loading branch information
scalvert committed Apr 7, 2021
commit 4546a4505e4d850eb957a53fc066d78d6d0026a5
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--TASK_NAME_START-->
# ember/ember-dependencies
<!--TASK_NAME_END-->

<!--TASK_DESCRIPTION_START-->
Finds Ember-specific dependencies and their versions in an Ember.js project
<!--TASK_DESCRIPTION_END-->

<!--RUN_START-->
## To run this task

```bash
checkup run --task ember/ember-dependencies
```
<!--RUN_END-->
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--TASK_NAME_START-->
# ember/ember-in-repo-addons-engines
<!--TASK_NAME_END-->

<!--TASK_DESCRIPTION_START-->
Finds all in-repo engines and addons in an Ember.js project
<!--TASK_DESCRIPTION_END-->

<!--RUN_START-->
## To run this task

```bash
checkup run --task ember/ember-in-repo-addons-engines
```
<!--RUN_END-->
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--TASK_NAME_START-->
# ember/ember-octane-migration-status
<!--TASK_NAME_END-->

<!--TASK_DESCRIPTION_START-->
Tracks the migration status when moving from Ember Classic to Ember Octane in an Ember.js project
<!--TASK_DESCRIPTION_END-->

<!--RUN_START-->
## To run this task

```bash
checkup run --task ember/ember-octane-migration-status
```
<!--RUN_END-->
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--TASK_NAME_START-->
# ember/ember-template-lint-disables
<!--TASK_NAME_END-->

<!--TASK_DESCRIPTION_START-->
Finds all disabled ember-template-lint rules in an Ember.js project
<!--TASK_DESCRIPTION_END-->

<!--RUN_START-->
## To run this task

```bash
checkup run --task ember/ember-template-lint-disables
```
<!--RUN_END-->
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--TASK_NAME_START-->
# ember/ember-template-lint-summary
<!--TASK_NAME_END-->

<!--TASK_DESCRIPTION_START-->
Gets a summary of all ember-template-lint results in an Ember.js project
<!--TASK_DESCRIPTION_END-->

<!--RUN_START-->
## To run this task

```bash
checkup run --task ember/ember-template-lint-summary
```
<!--RUN_END-->
15 changes: 15 additions & 0 deletions packages/checkup-plugin-ember/docs/tasks/ember-test-types-task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--TASK_NAME_START-->
# ember/ember-test-types
<!--TASK_NAME_END-->

<!--TASK_DESCRIPTION_START-->
Gets a breakdown of all test types in an Ember.js project
<!--TASK_DESCRIPTION_END-->

<!--RUN_START-->
## To run this task

```bash
checkup run --task ember/ember-test-types
```
<!--RUN_END-->
15 changes: 15 additions & 0 deletions packages/checkup-plugin-ember/docs/tasks/ember-types-task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--TASK_NAME_START-->
# ember/ember-types
<!--TASK_NAME_END-->

<!--TASK_DESCRIPTION_START-->
Gets a breakdown of all Ember types in an Ember.js project
<!--TASK_DESCRIPTION_END-->

<!--RUN_START-->
## To run this task

```bash
checkup run --task ember/ember-types
```
<!--RUN_END-->
3 changes: 2 additions & 1 deletion packages/checkup-plugin-ember/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"tslib": "^2"
},
"devDependencies": {
"@checkup/plugin": "^0.13.2",
"@checkup/test-helpers": "^0.13.2",
"fixturify-project": "^2.1.0",
"rimraf": "^3.0.2"
Expand All @@ -37,7 +38,7 @@
"scripts": {
"build": "tsc --build",
"test": "jest --no-cache",
"version": "git add README.md"
"docs:generate": "checkup-plugin docs"
},
"types": "lib/index.d.ts",
"main": "lib/index.js"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type Dependency = {
export default class EmberDependenciesTask extends BaseTask implements Task {
taskName = 'ember-dependencies';
taskDisplayName = 'Ember Dependencies';
description = 'Finds Ember-specific dependencies and their versions in an Ember.js project';
category = 'dependencies';
group = 'ember';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Result } from 'sarif';
export default class EmberInRepoAddonsEnginesTask extends BaseTask implements Task {
taskName = 'ember-in-repo-addons-engines';
taskDisplayName = 'Ember In-Repo Addons / Engines';
description = 'Finds all in-repo engines and addons in an Ember.js project';
category = 'metrics';
group = 'ember';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ const CUSTOM_RULE_MESSAGES = {
export default class EmberOctaneMigrationStatusTask extends BaseTask implements Task {
taskName = 'ember-octane-migration-status';
taskDisplayName = 'Ember Octane Migration Status';
description =
'Tracks the migration status when moving from Ember Classic to Ember Octane in an Ember.js project';
category = 'migrations';
group = 'ember';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const TEMPLATE_LINT_DISABLE = 'template-lint-disable';
export default class EmberTemplateLintDisableTask extends BaseTask implements Task {
taskName = 'ember-template-lint-disables';
taskDisplayName = 'Number of template-lint-disable Usages';
description = 'Finds all disabled ember-template-lint rules in an Ember.js project';
category = 'linting';
group = 'disabled-lint-rules';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { Result } from 'sarif';
export default class TemplateLintSummaryTask extends BaseTask implements Task {
taskName = 'ember-template-lint-summary';
taskDisplayName = 'Template Lint Summary';
description = 'Gets a summary of all ember-template-lint results in an Ember.js project';
category = 'linting';
group = 'ember';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { EMBER_TEST_TYPES } from '../utils/lint-configs';
export default class EmberTestTypesTask extends BaseTask implements Task {
taskName = 'ember-test-types';
taskDisplayName = 'Test Types';
description = 'Gets a breakdown of all test types in an Ember.js project';
category = 'testing';
group = 'ember';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const SEARCH_PATTERNS = [
export default class EmberTypesTask extends BaseTask implements Task {
taskName = 'ember-types';
taskDisplayName = 'Ember Types';
description = 'Gets a breakdown of all Ember types in an Ember.js project';
category = 'metrics';
group = 'ember';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--TASK_NAME_START-->
# javascript/eslint-disables
<!--TASK_NAME_END-->

<!--TASK_DESCRIPTION_START-->
Finds all disabled eslint rules in a project
<!--TASK_DESCRIPTION_END-->

<!--RUN_START-->
## To run this task

```bash
checkup run --task javascript/eslint-disables
```
<!--RUN_END-->
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--TASK_NAME_START-->
# javascript/eslint-summary
<!--TASK_NAME_END-->

<!--TASK_DESCRIPTION_START-->
Gets a summary of all eslint results in a project
<!--TASK_DESCRIPTION_END-->

<!--RUN_START-->
## To run this task

```bash
checkup run --task javascript/eslint-summary
```
<!--RUN_END-->
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--TASK_NAME_START-->
# javascript/outdated-dependencies
<!--TASK_NAME_END-->

<!--TASK_DESCRIPTION_START-->
Gets a summary of all outdated dependencies in a project
<!--TASK_DESCRIPTION_END-->

<!--RUN_START-->
## To run this task

```bash
checkup run --task javascript/outdated-dependencies
```
<!--RUN_END-->
3 changes: 2 additions & 1 deletion packages/checkup-plugin-javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"tslib": "^2"
},
"devDependencies": {
"@checkup/plugin": "^0.13.2",
"@checkup/test-helpers": "^0.13.2",
"fixturify-project": "^2.1.0",
"rimraf": "^3.0.2"
Expand All @@ -36,7 +37,7 @@
"scripts": {
"build": "tsc --build",
"test": "jest --no-cache",
"version": "git add README.md"
"docs:generate": "checkup-plugin docs"
},
"types": "lib/index.d.ts",
"main": "lib/index.js"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const ESLINT_DISABLE_REGEX = /^eslint-disable(?:-next-line|-line)*/gi;
export default class EslintDisableTask extends BaseTask implements Task {
taskName = 'eslint-disables';
taskDisplayName = 'Number of eslint-disable Usages';
description = 'Finds all disabled eslint rules in a project';
category = 'linting';
group = 'disabled-lint-rules';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const ACCEPTED_ESLINT_CONFIG_FILES = [
export default class EslintSummaryTask extends BaseTask implements Task {
taskName = 'eslint-summary';
taskDisplayName = 'Eslint Summary';
description = 'Gets a summary of all eslint results in a project';
category = 'linting';

private _eslintParser: Parser<ESLintReport>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ interface OutdatedDependency {
export default class OutdatedDependenciesTask extends BaseTask implements Task {
taskName = 'outdated-dependencies';
taskDisplayName = 'Outdated Dependencies';
description = 'Gets a summary of all outdated dependencies in a project';
category = 'dependencies';

async run(): Promise<Result[]> {
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/__tests__/checkup-task-runner-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { sarifLogMatcher } from './__utils__/sarif-match-object';
class FooTask extends BaseTask implements Task {
taskName = 'foo';
taskDisplayName = 'Foo Task';
description = 'description';
category = 'fake1';
group = 'group1';

Expand All @@ -21,6 +22,7 @@ class FooTask extends BaseTask implements Task {
class FileCountTask extends BaseTask implements Task {
taskName = 'file-count';
taskDisplayName = 'File Count Task';
description = 'description';
category = 'fake2';
group = 'group2';

Expand Down
14 changes: 8 additions & 6 deletions packages/cli/__tests__/task-list-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const STABLE_ERROR = new Error('Something went wrong in this task');
class InsightsTaskHigh extends BaseTask implements Task {
taskName = 'insights-task-high';
taskDisplayName = 'Insights Task High';
description = 'description';
category = 'bar';
group = 'group1';

Expand All @@ -33,6 +34,7 @@ class InsightsTaskHigh extends BaseTask implements Task {
class InsightsTaskLow extends BaseTask implements Task {
taskName = 'insights-task-low';
taskDisplayName = 'Insights Task Low';
description = 'description';
category = 'foo';
group = 'group2';

Expand All @@ -57,7 +59,7 @@ class InsightsTaskLow extends BaseTask implements Task {
class RecommendationsTaskHigh extends BaseTask implements Task {
taskName = 'recommendations-task-high';
taskDisplayName = 'Recommendations Task High';

description = 'description';
category = 'baz';

constructor(context: TaskContext) {
Expand All @@ -81,7 +83,7 @@ class RecommendationsTaskHigh extends BaseTask implements Task {
class RecommendationsTaskLow extends BaseTask implements Task {
taskName = 'recommendations-task-low';
taskDisplayName = 'Recommendations Task Low';

description = 'description';
category = 'bar';

constructor(context: TaskContext) {
Expand All @@ -105,7 +107,7 @@ class RecommendationsTaskLow extends BaseTask implements Task {
class MigrationTaskHigh extends BaseTask implements Task {
taskName = 'migration-task-high';
taskDisplayName = 'Migration Task High';

description = 'description';
category = 'foo';

constructor(context: TaskContext) {
Expand All @@ -129,7 +131,7 @@ class MigrationTaskHigh extends BaseTask implements Task {
class MigrationTaskLow extends BaseTask implements Task {
taskName = 'migration-task-low';
taskDisplayName = 'Migration Task Low';

description = 'description';
category = 'baz';

constructor(context: TaskContext) {
Expand All @@ -153,7 +155,7 @@ class MigrationTaskLow extends BaseTask implements Task {
class ErrorTask extends BaseTask implements Task {
taskName = 'error-task';
taskDisplayName = 'Error Task';

description = 'description';
category = 'bar';

constructor(context: TaskContext) {
Expand All @@ -167,7 +169,7 @@ class ErrorTask extends BaseTask implements Task {
class TaskWithoutCategory extends BaseTask implements Task {
taskName = 'task-without-category';
taskDisplayName = 'Task Without Category';

description = 'description';
category = '';

constructor(context: TaskContext) {
Expand Down
13 changes: 0 additions & 13 deletions packages/cli/src/api/checkup-task-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@ import { getLog } from '../get-log';
import TaskListImpl from '../task-list';
import { getPackageJson } from '../utils/get-package-json';
import PluginRegistrationProvider from './registration-provider';

let __tasksForTesting: Set<Task> = new Set<Task>();

export function _registerTaskForTesting(task: Task) {
__tasksForTesting.add(task);
}
export function _resetTasksForTesting() {
__tasksForTesting = new Set<Task>();
}
export default class CheckupTaskRunner {
actions: Action[] = [];
config!: CheckupConfig;
Expand Down Expand Up @@ -217,10 +208,6 @@ export default class CheckupTaskRunner {
registeredTasks: this.tasks,
}),
});

__tasksForTesting.forEach((task: Task) => {
this.tasks.registerTask(task);
});
}

private async loadFromPlugin(registrationArgs: RegistrationArgs) {
Expand Down
1 change: 1 addition & 0 deletions packages/core/__tests__/base-task-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { TaskContext } from '../src/types/tasks';
class FakeTask extends BaseTask {
taskName = 'my-fake';
taskDisplayName = 'Fake';
description = 'description';
category = 'foo';
}

Expand Down
Loading