Skip to content

Commit

Permalink
add psalm tests & a bit code cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Steffens <[email protected]>
  • Loading branch information
Florian Steffens committed Jan 15, 2024
1 parent 42508e8 commit 8a97e91
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 21 deletions.
14 changes: 3 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,26 +123,18 @@ test-api:

lint: lint-php lint-js lint-css lint-xml


lint-php: lint-phpfast lint-php-phan
lint-phpfast: lint-php-lint lint-php-cs-fixer lint-php-phpcs
lint-php: lint-php-lint lint-php-cs-fixer lint-php-psalm

lint-php-lint:
# Check PHP syntax errors
@! find $(php_dirs) -name "*.php" | xargs -I{} php -l '{}' | grep -v "No syntax errors detected"

lint-php-phan:
# PHAN
vendor/bin/phan --allow-polyfill-parser -k tests/phan-config.php --no-progress-bar -m checkstyle | vendor/bin/cs2pr --graceful-warnings --colorize

lint-php-phpcs:
# PHP CodeSniffer
vendor/bin/phpcs --standard=tests/phpcs.xml $(php_dirs) --report=checkstyle | vendor/bin/cs2pr --graceful-warnings --colorize

lint-php-cs-fixer:
# PHP Coding Standards Fixer (with Nextcloud coding standards)
vendor/bin/php-cs-fixer fix --dry-run --diff

lint-php-psalm:
composer psalm

lint-js:
npm run lint
Expand Down
52 changes: 52 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
resolveFromConfigFile="true"
findUnusedCode="false"
findUnusedBaselineEntry="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="tests/psalm-baseline.xml"
>
<stubs>
<file name="tests/stub.phpstub" preloadClasses="true"/>
</stubs>
<projectFiles>
<directory name="lib" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<extraFiles>
<directory name="vendor" />
</extraFiles>
<issueHandlers>
<UndefinedMagicMethod>
<errorLevel type="suppress">
<directory name="lib/" />
</errorLevel>
</UndefinedMagicMethod>
<UndefinedClass>
<errorLevel type="suppress">
<referencedClass name="Doctrine\DBAL\Exception" />
<referencedClass name="Doctrine\DBAL\Exception\InvalidFieldNameException" />
<referencedClass name="Doctrine\DBAL\Exception\TableNotFoundException" />
<referencedClass name="Doctrine\DBAL\Exception\UniqueConstraintViolationException" />
<referencedClass name="Doctrine\DBAL\Platforms\PostgreSQL94Platform" />
<referencedClass name="Doctrine\DBAL\Types\Types" />
</errorLevel>
</UndefinedClass>
<UndefinedDocblockClass>
<errorLevel type="suppress">
<referencedClass name="Doctrine\DBAL\Driver\Statement" />
<referencedClass name="Doctrine\DBAL\Exception" />
<referencedClass name="Doctrine\DBAL\Exception\UniqueConstraintViolationException" />
<referencedClass name="Doctrine\DBAL\Platforms\AbstractPlatform" />
<referencedClass name="Doctrine\DBAL\Schema\Schema" />
<referencedClass name="Doctrine\DBAL\Schema\SchemaException" />
<referencedClass name="Doctrine\DBAL\Schema\Table" />
</errorLevel>
</UndefinedDocblockClass>
</issueHandlers>
</psalm>
5 changes: 0 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,6 @@ export default {
margin-left: 5px;
}
.app-content {
padding-left: 15px;
padding-right: 15px;
}
.app-sidebar-tabs h3 {
border-bottom: 1px solid #80808057;
}
Expand Down
3 changes: 0 additions & 3 deletions src/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,3 @@ export default {
},
}
</script>
<style scoped lang="scss">
</style>
4 changes: 2 additions & 2 deletions src/store/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default new Vuex.Store({
updateAclFromCurrentPerson(state, acl) {
const currentPerson = this.state.persons[this.state.activePersonId]
const aclIndex = currentPerson.acl.findIndex((entry) => acl.id === entry.id)
Vue.set(this.state.persons[this.state.activePersonId].acl, aclIndex, acl)
state.persons[this.state.activePersonId].acl[aclIndex] = acl
},
deleteAclFromCurrentPerson(state, acl) {
const currentPerson = this.state.persons[this.state.activePersonId]
Expand Down Expand Up @@ -312,7 +312,7 @@ export default new Vuex.Store({
},
// ----------------
setSharees(state, shareesUsersAndGroups) {
Vue.set(state, 'sharees', shareesUsersAndGroups.exact.users)
state.sharees = shareesUsersAndGroups.exact.users
state.sharees.push(...shareesUsersAndGroups.exact.groups)
state.sharees.push(...shareesUsersAndGroups.users)
state.sharees.push(...shareesUsersAndGroups.groups)
Expand Down
2 changes: 2 additions & 0 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="dev-master@"/>
1 change: 1 addition & 0 deletions tests/stub.phpstub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php

0 comments on commit 8a97e91

Please sign in to comment.