diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..fb02f4c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: Build + +on: + push: + branches: + - master + - adding_sq + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - uses: sonarsource/sonarqube-scan-action@v3 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + # If you wish to fail your job when the Quality Gate is red, uncomment the + # following lines. This would typically be used to fail a deployment. + # We do not recommend to use this in a pull request. Prefer using pull request + # decoration instead. + # - uses: sonarsource/sonarqube-quality-gate-action@master + # timeout-minutes: 5 + # env: + # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}g \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ad96d1b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.scannerwork/ +.vscode/ \ No newline at end of file diff --git a/script.js b/script.js index c7a4b5f..ca76fdd 100644 --- a/script.js +++ b/script.js @@ -3,6 +3,7 @@ * * Manages the data of the application. */ +// FIXME here class Model { constructor() { this.todos = JSON.parse(localStorage.getItem('todos')) || [] @@ -31,7 +32,7 @@ class Model { editTodo(id, updatedText) { this.todos = this.todos.map(todo => - todo.id === id ? { id: todo.id, text: updatedText, complete: todo.complete } : todo + todo.id == id ? { id: todo.id, text: updatedText, complete: todo.complete } : todo ) this._commit(this.todos) @@ -45,7 +46,7 @@ class Model { toggleTodo(id) { this.todos = this.todos.map(todo => - todo.id === id ? { id: todo.id, text: todo.text, complete: !todo.complete } : todo + todo.id == id ? { id: todo.id, text: todo.text, complete: !todo.complete } : todo ) this._commit(this.todos) diff --git a/script.min.js b/script.min.js index 44fcf7b..5180f25 100644 --- a/script.min.js +++ b/script.min.js @@ -17,6 +17,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d */ var Model = /*#__PURE__*/ +// FIXME hi function () { function Model() { _classCallCheck(this, Model); diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..4a235dc --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,4 @@ +sonar.projectKey=mahwishriazjamil_mvc_b684ff3b-915c-4f57-b2af-55705d9be0f4 +sonar.sources=script.js,script.min.js +sonar.javascript.file.suffixes=.min.js,.js +sonar.inclusions=**/*.js \ No newline at end of file