Skip to content

Commit

Permalink
Fix/license_headers (#30)
Browse files Browse the repository at this point in the history
* Update license-header and pre-commit-action.yaml

* Added linter verification

* Fix self review findings

* Fix self review findings

* Fix some issues

* Update ci.yml

* Fix

Signed-off-by: Dennis Meister <[email protected]>

* Remove license header from .gitignore

* Update license header to 2024

Signed-off-by: Dennis Meister <[email protected]>

---------

Signed-off-by: Dennis Meister <[email protected]>
Co-authored-by: Dennis Meister <[email protected]>
Co-authored-by: BjoernAtBosch <[email protected]>
  • Loading branch information
3 people authored Jan 10, 2024
1 parent 72c7035 commit 5b7cac4
Show file tree
Hide file tree
Showing 35 changed files with 292 additions and 24 deletions.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0

name: 🐞 Bug Report
description: Provide a general summary of the bug in the title below.
title: "[Bug]: "
Expand Down
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0

name: 🛠️ Feature Request
description: Suggest an idea to help us improve our product.
title: "[Feature]: "
Expand Down
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0

name: ❓ Question or general issue
description: Approach us with a question
title: "[Q]: "
Expand Down
27 changes: 26 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,43 @@
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0

name: Run unit tests and coverage
on:
push:
branches: ['main']
pull_request:
branches: ['main']
jobs:
lint-job:
name: "Run linters"
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Run Linters
uses: pre-commit/[email protected]

build:
runs-on: ubuntu-latest
name: Run unit tests and publish package on main
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
node-version: 'lts/Hydrogen'
check-latest: true
registry-url: 'https://npm.pkg.github.com'
scope: '@eclipse-velocitas'
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0

name: Publish Package to GitHub
on:
workflow_dispatch:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.DS_Store
dist/
node_modules/
/coverage
/coverage
14 changes: 14 additions & 0 deletions .ort.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0

---
excludes:
scopes:
Expand Down
61 changes: 61 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
hooks:
- id: forbid-crlf
- id: remove-crlf
- id: insert-license
files: '.*\.(py|pyi|yaml|yml|sh|helmignore|dockerignore)$'
exclude: ^src/tests/files/
args:
- --license-filepath
- license_header.txt
- --comment-style
- "#"
- --use-current-year
- --allow-past-years
- --skip-license-insertion-comment=This file is maintained by velocitas CLI, do not modify manually.
- id: insert-license
files: '.*\.(ts)$'
args:
- --license-filepath
- license_header.txt
- --comment-style
- //
- --use-current-year
- --allow-past-years
- --skip-license-insertion-comment=This file is maintained by velocitas CLI, do not modify manually.
- id: insert-license
files: "Dockerfile.*"
args:
- --license-filepath
- license_header.txt
- --comment-style
- "#"
- --use-current-year
- --allow-past-years
- --skip-license-insertion-comment=This file is maintained by velocitas CLI, do not modify manually.
2 changes: 1 addition & 1 deletion license_header.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2022 Robert Bosch GmbH
Copyright (c) 2023 Contributors to the Eclipse Foundation

This program and the accompanying materials are made available under the
terms of the Apache License, Version 2.0 which is available at
Expand Down
2 changes: 1 addition & 1 deletion src/code-converter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022 Robert Bosch GmbH
// Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Apache License, Version 2.0 which is available at
Expand Down
2 changes: 1 addition & 1 deletion src/gitRequestHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Robert Bosch GmbH
// Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Apache License, Version 2.0 which is available at
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022 Robert Bosch GmbH
// Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Apache License, Version 2.0 which is available at
Expand Down
18 changes: 16 additions & 2 deletions src/pipeline/create-code-snippet.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Apache License, Version 2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
//
// SPDX-License-Identifier: Apache-2.0

import { CodeContext } from '../code-converter';
import { INDENTATION, VELOCITAS } from '../utils/codeConstants';
import { createMultilineStringFromArray, indentCodeSnippet, variableConditionCheck } from '../utils/helpers';
Expand All @@ -14,7 +28,7 @@ export class CreateCodeSnippetForTemplateStep extends PipelineStep {
context.codeSnippetForTemplate = `${indentCodeSnippet(VELOCITAS.ON_START, INDENTATION.COUNT_CLASS)}\n${indentCodeSnippet(
this.adaptCodeBlocksToVelocitasStructure(createMultilineStringFromArray(context.codeSnippetStringArray)),
INDENTATION.COUNT_METHOD
)}`;
)}`;
}
private changeMemberVariables(context: CodeContext) {
context.variableNames.forEach((variableName: string) => {
Expand All @@ -34,7 +48,7 @@ export class CreateCodeSnippetForTemplateStep extends PipelineStep {
context.codeSnippetStringArray[index] = stringElement.replace(variableName, `self.${variableName}`);
}

if (variableConditionCheck(stringElement,variableName)) {
if (variableConditionCheck(stringElement, variableName)) {
context.codeSnippetStringArray[index] = stringElement.replace(variableRegex(variableName), `self.${variableName}`);
}
});
Expand Down
14 changes: 14 additions & 0 deletions src/pipeline/extract-classes.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Apache License, Version 2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
//
// SPDX-License-Identifier: Apache-2.0

import { CodeContext } from '../code-converter';
import { PYTHON } from '../utils/codeConstants';
import { REGEX } from '../utils/regex';
Expand Down
14 changes: 14 additions & 0 deletions src/pipeline/extract-imports.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Apache License, Version 2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
//
// SPDX-License-Identifier: Apache-2.0

import { CodeContext } from '../code-converter';
import { PYTHON } from '../utils/codeConstants';
import { PipelineStep } from './pipeline-base';
Expand Down
16 changes: 15 additions & 1 deletion src/pipeline/extract-methods.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Apache License, Version 2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
//
// SPDX-License-Identifier: Apache-2.0

import { CodeContext } from '../code-converter';
import { DIGITAL_AUTO, INDENTATION, PYTHON, VELOCITAS } from '../utils/codeConstants';
import { createMultilineStringFromArray, indentCodeSnippet, variableConditionCheck } from '../utils/helpers';
Expand Down Expand Up @@ -83,7 +97,7 @@ export class ExtractMethodsStep extends PipelineStep {
}
private changeMemberVariablesInString(codeSnippet: string, context: CodeContext): string {
context.variableNames?.forEach((variableName: string) => {
if (variableConditionCheck(codeSnippet,variableName)) {
if (variableConditionCheck(codeSnippet, variableName)) {
codeSnippet = codeSnippet.replace(variableRegex(variableName), `self.${variableName}`);
}
});
Expand Down
14 changes: 14 additions & 0 deletions src/pipeline/extract-variables.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Apache License, Version 2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
//
// SPDX-License-Identifier: Apache-2.0

import { CodeContext } from '../code-converter';
import { INDENTATION } from '../utils/codeConstants';
import { createMultilineStringFromArray, indentCodeSnippet } from '../utils/helpers';
Expand Down
14 changes: 14 additions & 0 deletions src/pipeline/pipeline-base.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Apache License, Version 2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
//
// SPDX-License-Identifier: Apache-2.0

import { CodeContext } from '../code-converter';
import { VELOCITAS } from '../utils/codeConstants';
import { REGEX } from '../utils/regex';
Expand Down
14 changes: 14 additions & 0 deletions src/pipeline/prepare-code-snippet.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Apache License, Version 2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
//
// SPDX-License-Identifier: Apache-2.0

import { CodeContext } from '../code-converter';
import { DIGITAL_AUTO, PYTHON } from '../utils/codeConstants';
import { PipelineStep } from './pipeline-base';
Expand Down
2 changes: 1 addition & 1 deletion src/project-generator-error.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022 Robert Bosch GmbH
// Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Apache License, Version 2.0 which is available at
Expand Down
2 changes: 1 addition & 1 deletion src/project-generator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022 Robert Bosch GmbH
// Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Apache License, Version 2.0 which is available at
Expand Down
2 changes: 1 addition & 1 deletion src/tests/appManifest.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Robert Bosch GmbH
// Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Apache License, Version 2.0 which is available at
Expand Down
Loading

0 comments on commit 5b7cac4

Please sign in to comment.