Skip to content

Commit

Permalink
Setup CI/CD for sonarqube analysis (#20)
Browse files Browse the repository at this point in the history
* [CHORES] Sonarquebe analysis

* [CHORES] Add sonarqube properties

* [REFACTOR] Remove unused variable on setup

* [CHORES] Sonar scan on each branch

* [CHORES] fix sonar branching

* [CHORES] fix sonar branching

* [CHORES] fix sonar branching

* [CHORES] fix sonar branching

* [CHORES] fix branch naming]
  • Loading branch information
nofamex authored Mar 8, 2022
1 parent 9c81f00 commit 8457310
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 25 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on: push
name: Sonarqube
jobs:
sonarQubeTrigger:
name: SonarQube Trigger
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
with:
args: >
-Dsonar.branch.name=${{ github.ref_name }}
env:
SONAR_TOKEN: "0052493ad45d69d2bc55d9bd64e9f8cc9da0bec0"
SONAR_HOST_URL: "https://pmpl.cs.ui.ac.id/sonarqube"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/vendor/
composer.lock
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"autoload": {
"psr-4": {
"Uasoft\\Badaso\\Module\\LMSModule\\": "src/",
"Uasoft\\Badaso\\Module\\LMSModule\\Seeders": "src/seeders"
"Uasoft\\Badaso\\Module\\LMSModule\\Seeders\\": "src/seeders"
}
},
"autoload-dev": {
Expand Down
2 changes: 2 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sonar.projectKey=ppl2022-d-uasoft_lms_module
sonar.sources=src/
8 changes: 4 additions & 4 deletions src/Commands/LMSModuleSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class LMSModuleSetup extends Command {
*
* @var string
*/
protected $name = 'badaso-lms:setup';
protected $name = 'badaso-lms-module:setup';

/**
* The console command description.
Expand Down Expand Up @@ -74,7 +74,7 @@ protected function addBadasoEnv() {
$new_env_adding = [];
foreach ($env_will_adding as $key_add_env => $val_add_env) {
$status_adding = true;
foreach ($arr_env_file as $key_env_file => $val_env_file) {
foreach ($arr_env_file as $val_env_file) {
$val_env_file = trim($val_env_file);
if (substr($val_env_file, 0, 1) != '#' && $val_env_file != '' && strstr($val_env_file, $key_add_env)) {
$status_adding = false;
Expand All @@ -86,7 +86,7 @@ protected function addBadasoEnv() {
}
}

foreach ($new_env_adding as $index_env_add => $val_env_add) {
foreach ($new_env_adding as $val_env_add) {
$arr_env_file[] = $val_env_add;
}

Expand All @@ -105,7 +105,7 @@ protected function addLMSTablesToHiddenTables() {
$config_hidden_tables = require $config_path;
$tables = LMSModule::getProtectedTables();

foreach ($tables as $key => $value) {
foreach ($tables as $value) {
if (! in_array($value, $config_hidden_tables)) {
array_push($config_hidden_tables, $value);
}
Expand Down
20 changes: 0 additions & 20 deletions tests/Feature/ExampleTest.php

This file was deleted.

0 comments on commit 8457310

Please sign in to comment.