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

Add editor config and sonarcloud config #292

Merged
merged 8 commits into from
Nov 26, 2024
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
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
tab_width = 4
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

[*.txt]
trim_trailing_whitespace = false

[*.{md,json,yml}]
trim_trailing_whitespace = false
indent_style = space
indent_size = 2

[*.json]
indent_style = tab
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@ on:
workflow_dispatch: ~

jobs:

sonarcloud:
name: SonarQube Cloud
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarQube Cloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
lint:
name: Lint code
runs-on: ubuntu-22.04
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PHP_VERSION
ARG PHP_VERSION=latest

FROM composer:2 AS composer
FROM php:${PHP_VERSION}
Expand Down
12 changes: 6 additions & 6 deletions Dockerfile.legacy
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ ENV DEBIAN_FRONTEND=noninteractive
sed -i s/stretch-updates/stretch/g /etc/apt/sources.list

# Install dependencies
RUN apt update && \
apt install -y --no-install-recommends \
RUN apt update \
&& apt install -y --no-install-recommends \
git \
zip \
unzip \
rsync \
unzip \
zip \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

# Create non-root user
RUN useradd -u ${UID} -ms /bin/bash phpuser
Expand Down
15 changes: 15 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# General setup
sonar.projectKey=alma_alma-woocommerce-gateway
sonar.organization=almapay
# This is the name and version displayed in the SonarCloud UI.
sonar.projectName=alma-woocommerce-gateway
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
sonar.sources=src/
sonar.exclusions=src/.composer/**,src/.subversion/**,src/assets/widget/**,src/bin/**,src/build/**,src/languages/**,src/vendor/**,src/.phpcs.xml.dist,src/.phpunit.result.cache,src/phpcs.xml,src/phpunit.xml.dist,src/phpcs.xml
# Test folders
sonar.tests=src/tests/
sonar.test.inclusions=src/tests/**/*
# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
# Exclude files from coverage
sonar.coverage.exclusions=src/tests/**/*