Skip to content

Commit b91da0d

Browse files
authored
Merge pull request #44 from sumocoders/362-improve-code
362 improve code
2 parents 4407557 + b78ba11 commit b91da0d

125 files changed

Lines changed: 6169 additions & 2501 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# Real environment variables win over .env files.
1010
#
1111
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12+
# https://symfony.com/doc/current/configuration/secrets.html
1213
#
1314
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
1415
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
@@ -26,21 +27,28 @@ APP_SECRET=9947170bb921f0390a44d613fa7a3ce5
2627
DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7"
2728
# DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
2829
###< doctrine/doctrine-bundle ###
29-
###> sumocoders/framework-core-bundle ###
30-
SITE_TITLE="Your application"
31-
DEFAULT_URI="https://www.example.com"
32-
###< sumocoders/framework-core-bundle ###
30+
31+
###> sentry/sentry-symfony ###
32+
SENTRY_DSN=
33+
###< sentry/sentry-symfony ###
34+
35+
###> symfony/mailer ###
36+
MAILER_DSN=null://null
37+
MAILER_DEFAULT_SENDER_NAME="Your application"
38+
MAILER_DEFAULT_SENDER_EMAIL="mailer_default_sender_email_is_misconfigured@tesuta.be"
39+
MAILER_DEFAULT_TO_NAME="Your application"
40+
MAILER_DEFAULT_TO_EMAIL="mailer_default_to_email_is_misconfigured@tesuta.be"
41+
###< symfony/mailer ###
42+
3343
###> symfony/messenger ###
3444
# Choose one of the transports below
35-
# MESSENGER_TRANSPORT_DSN=doctrine://default
3645
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
3746
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
47+
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
3848
###< symfony/messenger ###
3949

40-
###> symfony/mailer ###
41-
MAILER_DSN=smtp://localhost
42-
MAILER_DEFAULT_SENDER_NAME=
43-
MAILER_DEFAULT_SENDER_EMAIL=
44-
MAILER_DEFAULT_TO_NAME=
45-
MAILER_DEFAULT_TO_EMAIL=
46-
###< symfony/mailer ###
50+
###> sumocoders/framework-core-bundle ###
51+
SITE_TITLE="Your application"
52+
ENCRYPTION_KEY="8ea13de9680e2a1441774ec26642fa65a56d8099f44a301f219864b51bbaa925"
53+
DEFAULT_URI="/"
54+
###< sumocoders/framework-core-bundle ###

.env.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
KERNEL_CLASS='App\Kernel'
33
APP_SECRET='$ecretf0rt3st'
44
SYMFONY_DEPRECATIONS_HELPER=999999
5-
#DATABASE_URL="sqlite:///%kernel.project_dir%/var/test.db"
6-
DATABASE_URL="sqlite:///:memory:"
5+
DATABASE_URL="mysql://root:root@127.0.0.1:3306/ci?serverVersion=5.7"
6+
MAILER_DSN=null://default

.gitignore

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
.phpcs-cache
2-
.phpunit.result.cache
3-
41
###> symfony/framework-bundle ###
52
/.env.local
63
/.env.local.php
@@ -11,27 +8,25 @@
118
/vendor/
129
###< symfony/framework-bundle ###
1310

14-
###> symfony/webpack-encore-bundle ###
15-
/node_modules/
16-
/public/build/
17-
npm-debug.log
18-
yarn-error.log
19-
###< symfony/webpack-encore-bundle ###
11+
###> phpstan/phpstan ###
12+
phpstan.neon
13+
###< phpstan/phpstan ###
14+
15+
###> phpunit/phpunit ###
16+
/phpunit.xml
17+
/.phpunit.cache/
18+
###< phpunit/phpunit ###
2019

2120
###> squizlabs/php_codesniffer ###
2221
/.phpcs-cache
2322
/phpcs.xml
2423
###< squizlabs/php_codesniffer ###
2524

25+
###> symfony/asset-mapper ###
26+
/public/assets/
27+
/assets/vendor/
28+
###< symfony/asset-mapper ###
29+
2630
###> vincentlanglet/twig-cs-fixer ###
2731
/.twig-cs-fixer.cache
2832
###< vincentlanglet/twig-cs-fixer ###
29-
30-
###> phpstan/phpstan ###
31-
phpstan.neon
32-
###< phpstan/phpstan ###
33-
34-
###> symfony/phpunit-bridge ###
35-
.phpunit.result.cache
36-
/phpunit.xml
37-
###< symfony/phpunit-bridge ###

.gitlab-ci.yml

Lines changed: 69 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ stages:
22
- build
33
- code quality
44
- dependency scanning
5+
- outdated packages
56
- test
67
- deploy
78

@@ -17,13 +18,12 @@ cache: &global_cache
1718

1819
# Build section
1920
Install dependencies and build assets:
20-
image: sumocoders/cli-tools-php83:latest
21+
image: sumocoders/cli-tools-php84:latest
2122
script:
2223
- COMPOSER_MEMORY_LIMIT=-1 composer install --no-scripts --no-progress
2324
- COMPOSER_MEMORY_LIMIT=-1 composer run-script post-autoload-dump
24-
- volta install node
25-
- npm ci --no-progress
26-
- node_modules/.bin/encore production
25+
- php bin/console importmap:install --no-interaction
26+
- php bin/console sass:build --no-interaction
2727
- php bin/console fos:js-routing:dump --format=json --locale=nl --target=public/build/routes/fos_js_routes.json
2828
cache:
2929
<<: *global_cache
@@ -35,154 +35,162 @@ Install dependencies and build assets:
3535

3636
# Code Quality section
3737
PHP_CodeSniffer - check code styling:
38-
image: sumocoders/cli-tools-php83:latest
38+
image: sumocoders/cli-tools-php84:latest
3939
script:
40-
- vendor/bin/phpcs --report-full --report-\\Micheh\\PhpCodeSniffer\\Report\\Gitlab=phpcs-report.xml
40+
- php vendor/bin/phpcs --report-full --report-\\Micheh\\PhpCodeSniffer\\Report\\Gitlab=phpcs-report.json
4141
artifacts:
4242
expire_in: 1 week
4343
reports:
44-
codequality: phpcs-report.xml
44+
codequality: phpcs-report.json
4545
stage: code quality
46-
needs: ["Install dependencies and build assets"]
46+
needs: [ "Install dependencies and build assets" ]
4747
tags:
4848
- docker
4949

5050
PHPStan - check for bugs:
51-
image: sumocoders/cli-tools-php83:latest
51+
image: sumocoders/cli-tools-php84:latest
5252
before_script:
53-
- bin/console cache:warmup --env=dev
53+
- php bin/console cache:warmup --env=dev
5454
script:
55-
- vendor/bin/phpstan analyse --memory-limit=-1 --error-format=gitlab --no-progress --no-interaction > phpstan-report.xml
55+
- php vendor/bin/phpstan analyse --memory-limit=-1 --error-format=gitlab --no-progress --no-interaction > phpstan-report.json
5656
after_script:
5757
# Run it again so the output is visible in the job
5858
- >
5959
if [ $CI_JOB_STATUS != 'success' ]; then
60-
vendor/bin/phpstan analyse --memory-limit=-1 --no-progress
60+
php vendor/bin/phpstan analyse --memory-limit=-1 --no-progress
6161
fi
6262
artifacts:
6363
expire_in: 1 week
6464
reports:
65-
codequality: phpstan-report.xml
65+
codequality: phpstan-report.json
6666
stage: code quality
67-
needs: ["Install dependencies and build assets"]
67+
needs: [ "Install dependencies and build assets" ]
6868
tags:
6969
- docker
7070

7171
Twig-CS-Fixer - check code styling:
72-
image: sumocoders/cli-tools-php83:latest
72+
image: sumocoders/cli-tools-php84:latest
7373
script:
74-
- vendor/bin/twig-cs-fixer lint templates/ --report=junit > twigcs-report.xml
74+
- php vendor/bin/twig-cs-fixer lint templates/ --report=junit > twigcs-report.xml
7575
after_script:
7676
# Run it again so the output is visible in the job
77-
- vendor/bin/twig-cs-fixer lint templates/
77+
- >
78+
if [ $CI_JOB_STATUS != 'success' ]; then
79+
php vendor/bin/twig-cs-fixer --no-interaction lint templates/
80+
fi
7881
artifacts:
7982
expire_in: 1 week
8083
reports:
8184
junit: twigcs-report.xml
8285
stage: code quality
83-
needs: ["Install dependencies and build assets"]
86+
needs: [ "Install dependencies and build assets" ]
8487
tags:
8588
- docker
8689
allow_failure: true
8790

8891
Stylelint - check code styling:
89-
image: sumocoders/cli-tools-php83:latest
92+
image: sumocoders/stylelint:latest
9093
script:
91-
- node_modules/.bin/stylelint --output-file=stylelint-report.json --custom-formatter=node_modules/stylelint-formatter-gitlab-code-quality-report/index.js .
94+
- stylelint --output-file=stylelint-report.json --custom-formatter=stylelint-formatter-gitlab-code-quality-report .
9295
after_script:
93-
# Run it again so the output is visible in the job
94-
- node_modules/.bin/stylelint --color .
96+
- >
97+
if [ $CI_JOB_STATUS != 'success' ]; then
98+
stylelint --color .
99+
fi
95100
artifacts:
96101
expire_in: 1 week
97102
reports:
98103
codequality: stylelint-report.json
99104
stage: code quality
100-
needs: ["Install dependencies and build assets"]
105+
needs: [ "Install dependencies and build assets" ]
101106
tags:
102107
- docker
103108
allow_failure: true
104109

105110
StandardJS - check code styling:
106-
image: sumocoders/cli-tools-php83:latest
111+
image: sumocoders/standardjs:latest
107112
script:
108-
- node_modules/.bin/standard | node_modules/.bin/standard-gitlab --output-file standardjs-report.json --human-readable
113+
- sh -c 'standard . | standard-gitlab --output-file standardjs-report.json --human-readable'
109114
artifacts:
110115
expire_in: 1 week
111116
reports:
112117
codequality: standardjs-report.json
113118
stage: code quality
114-
needs: ["Install dependencies and build assets"]
119+
needs: [ "Install dependencies and build assets" ]
115120
tags:
116121
- docker
117122
allow_failure: true
118123

119124

120125
# Dependency Scanning section
121126
NPM packages - check for vulnerabilities:
122-
image: sumocoders/cli-tools-php83:latest
127+
image: sumocoders/cli-tools-php84:latest
123128
script:
124-
- npm audit --omit=dev --json | ./node_modules/.bin/gitlab-npm-audit-parser -o npm-audit-report.json
125-
- npm audit --omit=dev
126-
artifacts:
127-
expire_in: 1 week
128-
reports:
129-
dependency_scanning: npm-audit-report.json
129+
- php bin/console importmap:audit --no-interaction --ansi
130130
stage: dependency scanning
131-
needs: ["Install dependencies and build assets"]
131+
needs: [ "Install dependencies and build assets" ]
132132
tags:
133133
- docker
134134
allow_failure: true
135135

136-
PHP packages - local-php-security-checker:
137-
image: sumocoders/cli-tools-php83:latest
138-
before_script:
139-
- PHP_SC_VERSION=$(curl -s "https://api.github.com/repos/fabpot/local-php-security-checker/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/;s/^v//')
140-
- curl -LSs https://github.com/fabpot/local-php-security-checker/releases/download/v${PHP_SC_VERSION}/local-php-security-checker_linux_amd64 > ./local-php-security-checker
141-
- chmod +x ./local-php-security-checker
136+
PHP packages - composer audit:
137+
image: sumocoders/cli-tools-php84:latest
142138
script:
143-
- ./local-php-security-checker --format=ansi
139+
- composer audit --ansi --no-interaction
144140
stage: dependency scanning
145-
needs: ["Install dependencies and build assets"]
141+
needs: [ "Install dependencies and build assets" ]
146142
tags:
147143
- docker
148144
allow_failure: true
149145

150-
PHP packages - composer audit:
151-
image: sumocoders/cli-tools-php83:latest
146+
147+
# Outdated packages Scanning section
148+
NPM packages - check for outdated packages:
149+
image: sumocoders/cli-tools-php84:latest
152150
script:
153-
- composer audit --ansi --no-interaction
154-
stage: dependency scanning
155-
needs: ["Install dependencies and build assets"]
151+
- php bin/console importmap:outdated --no-interaction --ansi
152+
stage: outdated packages
153+
needs: [ "Install dependencies and build assets" ]
154+
tags:
155+
- docker
156+
allow_failure: true
157+
158+
PHP packages - composer outdated:
159+
image: sumocoders/cli-tools-php84:latest
160+
script:
161+
- composer outdated --ansi --no-interaction
162+
stage: outdated packages
163+
needs: [ "Install dependencies and build assets" ]
156164
tags:
157165
- docker
158166
allow_failure: true
159167

160168

161169
# Test section
162170
PHPUnit - Run tests:
163-
image: sumocoders/framework-php83:latest
171+
image: sumocoders/framework-php84:latest
164172
services:
165173
- mysql:5.7
166174
before_script:
167-
# Uncomment this if you need Chrome for PDF's
168-
# or if you have integration tests that use Symfony Panther (https://github.com/symfony/panther)
169-
# # install Chromium
170-
# - apt-get --allow-releaseinfo-change update && apt-get install -y chromium
171-
# # install Chromium Chromedriver
172-
# - |
173-
# curl -s -f -L -o /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE_97`/chromedriver_linux64.zip
174-
# unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/
175+
# Uncomment this if you need Chrome for PDF's
176+
# or if you have integration tests that use Symfony Panther (https://github.com/symfony/panther)
177+
# # install Chromium
178+
# - apt-get --allow-releaseinfo-change update && apt-get install -y chromium
179+
# # install Chromium Chromedriver
180+
# - |
181+
# curl -s -f -L -o /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE_97`/chromedriver_linux64.zip
182+
# unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/
175183
script:
176184
- php bin/console doctrine:migrations:migrate --env=test --no-interaction --allow-no-migration
177185
# Uncomment this if you have fixtures that need to be loaded
178186
# Make sure that you have installed doctrine/doctrine-fixtures-bundle
179187
#- php bin/console doctrine:fixtures:load --env=test
180-
- php vendor/bin/simple-phpunit --log-junit phpunit-report.xml
188+
- php vendor/bin/phpunit --color --testdox --log-junit phpunit-report.xml
181189
artifacts:
182190
reports:
183191
junit: phpunit-report.xml
184192
stage: test
185-
needs: ["Install dependencies and build assets"]
193+
needs: [ "Install dependencies and build assets" ]
186194
tags:
187195
- docker
188196
variables:
@@ -195,7 +203,7 @@ PHPUnit - Run tests:
195203

196204
# Deploy section
197205
Deploy - to staging:
198-
image: sumocoders/cli-tools-php83:latest
206+
image: sumocoders/cli-tools-php84:latest
199207
before_script:
200208
# Add the private SSH key to the CI environment
201209
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
@@ -206,10 +214,10 @@ Deploy - to staging:
206214
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
207215
- chmod 644 ~/.ssh/known_hosts
208216
script:
209-
- vendor/bin/dep deploy stage=staging
217+
- php vendor/bin/dep deploy stage=staging
210218
environment:
211219
name: staging
212-
url: https://$project.$client.php83.sumocoders.eu
220+
url: https://$project.$client.php84.sumocoders.eu
213221
only:
214222
- staging
215223
stage: deploy

.stylelintignore

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
assets/images/*.svg
1+
assets/images/
2+
assets/vendor/
23
bin/*
34
config/*
4-
public/build/*
5-
public/bundles/*
6-
public/files/*
5+
drivers/*
6+
migrations/*
77
node_modules/*
8+
public/*
9+
src/*
10+
tests/*
11+
translations/*
812
var/*
913
vendor/*
10-
**/*.dist
11-
**/*.json
12-
**/*.lock
13-
**/*.yaml
14-
**/*.yml
15-
php.ini
14+
*.*
15+
!*.css
16+
!*.scss

0 commit comments

Comments
 (0)