Skip to content

Commit

Permalink
Merge pull request #26 from xdev-software/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
AB-xdev authored Aug 30, 2024
2 parents 4ac01a8 + 5c5f76f commit 397652c
Show file tree
Hide file tree
Showing 30 changed files with 1,227 additions and 524 deletions.
155 changes: 155 additions & 0 deletions .config/pmd/ruleset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Default"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">

<description>
This ruleset checks the code for discouraged programming constructs.
</description>

<!-- Only rules that don't overlap with CheckStyle! -->

<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP"/>
<rule ref="category/java/bestpractices.xml/PreserveStackTrace"/>
<rule ref="category/java/bestpractices.xml/UseCollectionIsEmpty"/>
<rule ref="category/java/bestpractices.xml/UseStandardCharsets"/>

<!-- Native code is platform dependent; Loading external native libs might pose a security threat -->
<rule ref="category/java/codestyle.xml/AvoidUsingNativeCode"/>
<rule ref="category/java/codestyle.xml/IdenticalCatchBranches"/>
<rule ref="category/java/codestyle.xml/NoPackage"/>
<rule ref="category/java/codestyle.xml/PrematureDeclaration"/>

<rule ref="category/java/design.xml">
<!-- Sometimes abstract classes have just fields -->
<exclude name="AbstractClassWithoutAnyMethod"/>

<!-- Using RuntimeExceptions is ok -->
<exclude name="AvoidCatchingGenericException"/>
<exclude name="AvoidThrowingRawExceptionTypes"/>

<!-- Limit too low -->
<exclude name="AvoidDeeplyNestedIfStmts"/>

<!-- Limit too low -->
<exclude name="CouplingBetweenObjects"/>

<!-- Limit too low -->
<exclude name="CyclomaticComplexity"/>

<!-- Makes entity classes impossible -->
<exclude name="DataClass"/>

<!-- Used commonly particular in bigger methods with upstream throws -->
<exclude name="ExceptionAsFlowControl"/>

<!-- Limit too low -->
<exclude name="ExcessiveImports"/>

<!-- Handled by TooManyFields/TooManyMethods -->
<exclude name="ExcessivePublicCount"/>

<!-- Prohibits accessing members using multiple depths -->
<exclude name="LawOfDemeter"/>

<!-- No effect -->
<exclude name="LoosePackageCoupling"/>

<!-- Prohibits singleton pattern -->
<exclude name="MutableStaticState"/>

<!-- Checks LoC, already handled by Checkstyle -->
<exclude name="NcssCount"/>

<!-- Some override methods or Junit require this -->
<exclude name="SignatureDeclareThrowsException"/>

<!-- Reports FP for equals methods -->
<exclude name="SimplifyBooleanReturns"/>

<!-- Limit too low -->
<exclude name="TooManyFields"/>

<!-- Limit too low -->
<exclude name="TooManyMethods"/>

<!-- Limit too low -->
<exclude name="UseObjectForClearerAPI"/>

<!-- Handled by checkstyle -->
<exclude name="UseUtilityClass"/>
</rule>

<rule ref="category/java/design.xml/AvoidDeeplyNestedIfStmts">
<properties>
<property name="problemDepth" value="4"/>
</properties>
</rule>
<rule ref="category/java/design.xml/CouplingBetweenObjects">
<properties>
<property name="threshold" value="100"/>
</properties>
</rule>
<rule ref="category/java/design.xml/CyclomaticComplexity">
<properties>
<property name="classReportLevel" value="150"/>
<property name="methodReportLevel" value="25"/>
<property name="cycloOptions" value=""/>
</properties>
</rule>
<rule ref="category/java/design.xml/ExcessiveImports">
<properties>
<property name="minimum" value="200"/>
</properties>
</rule>
<rule ref="category/java/design.xml/TooManyFields">
<properties>
<property name="maxfields" value="50"/>
</properties>
</rule>
<rule ref="category/java/design.xml/TooManyMethods">
<properties>
<property name="maxmethods" value="100"/>
</properties>
</rule>

<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues"/>
<rule ref="category/java/errorprone.xml/BrokenNullCheck"/>
<rule ref="category/java/errorprone.xml/ComparisonWithNaN"/>
<rule ref="category/java/errorprone.xml/DoNotCallGarbageCollectionExplicitly"/>
<rule ref="category/java/errorprone.xml/DontImportSun"/>
<rule ref="category/java/errorprone.xml/MisplacedNullCheck"/>
<rule ref="category/java/errorprone.xml/UnnecessaryCaseChange"/>


<rule ref="category/java/multithreading.xml">
<!-- Just bloats code -->
<exclude name="AvoidSynchronizedAtMethodLevel"/>

<!-- NOPE -->
<exclude name="DoNotUseThreads"/>

<!-- Doesn't detect nested thread safe singleton pattern -->
<exclude name="NonThreadSafeSingleton"/>

<!-- Should relevant for fields that use multithreading which is rare -->
<exclude name="UseConcurrentHashMap"/>
</rule>

<rule ref="category/java/performance.xml">
<!-- This was fixed in Java 10 -->
<exclude name="AvoidFileStream"/>

<!-- Used everywhere and has neglectable performance impact -->
<exclude name="AvoidInstantiatingObjectsInLoops"/>

<!-- Handled by checkstyle -->
<exclude name="RedundantFieldInitializer"/>

<!-- Nowadays optimized by compiler; No code bloating needed -->
<exclude name="UseStringBufferForStringAppends"/>
</rule>

<rule ref="category/java/security.xml"/>
</ruleset>
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# Auto detect text files and perform LF normalization
* text=auto

# Force sh files to have LF
*.sh text eol=lf

# Force MVN Wrapper Linux files LF
mvnw text eol=lf
.mvn/wrapper/maven-wrapper.properties text eol=lf
3 changes: 3 additions & 0 deletions .github/.lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignorefile for broken link check
localhost
mvnrepository.com
68 changes: 68 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: 🐞 Bug
description: Create a bug report for something that is broken
labels: [bug]
body:
- type: markdown
attributes:
value: |
Thank you for reporting a bug.
Please fill in as much information as possible about your bug so that we don't have to play "information ping-pong" and can help you immediately.
- type: checkboxes
id: checklist
attributes:
label: "Checklist"
options:
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/hierarchical-stopwatch/releases/latest)"
required: true
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/hierarchical-stopwatch/issues) or [closed](https://github.com/xdev-software/hierarchical-stopwatch/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
required: true
- label: "This issue contains only one bug."
required: true

- type: input
id: app-version
attributes:
label: Affected version
description: "In which version did you encounter the bug?"
placeholder: "x.x.x"
validations:
required: true

- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to reproduce the bug
description: |
What did you do for the bug to show up?
If you can't cause the bug to show up again reliably (and hence don't have a proper set of steps to give us), please still try to give as many details as possible on how you think you encountered the bug.
placeholder: |
1. Use '...'
2. Do '...'
validations:
required: true

- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: |
Tell us what you expect to happen.
- type: textarea
id: actual-behavior
attributes:
label: Actual behavior
description: |
Tell us what happens with the steps given above.
- type: textarea
id: additional-information
attributes:
label: Additional information
description: |
Any other relevant information you'd like to include
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
contact_links:
- name: 💬 Contact support
url: https://xdev.software/en/services/support
about: "If you need support as soon as possible or/and you can't wait for any pull request"
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/enhancement.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: ✨ Feature/Enhancement
description: Suggest a new feature or enhancement
labels: [enhancement]
body:
- type: markdown
attributes:
value: |
Thank you for suggesting a new feature/enhancement.
- type: checkboxes
id: checklist
attributes:
label: "Checklist"
options:
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/hierarchical-stopwatch/issues) or [closed](https://github.com/xdev-software/hierarchical-stopwatch/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
required: true
- label: "This issue contains only one feature request/enhancement."
required: true

- type: textarea
id: description
attributes:
label: Description
validations:
required: true

- type: textarea
id: additional-information
attributes:
label: Additional information
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: ❓ Question
description: Ask a question
labels: [question]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this form!
- type: checkboxes
id: checklist
attributes:
label: "Checklist"
options:
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/hierarchical-stopwatch/issues) or [closed](https://github.com/xdev-software/hierarchical-stopwatch/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
required: true

- type: textarea
id: what-is-the-question
attributes:
label: What is/are your question(s)?
validations:
required: true

- type: textarea
id: additional-information
attributes:
label: Additional information
description: "Any other information you'd like to include - for instance logs, screenshots, etc."
38 changes: 38 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Default
## Required for template
- name: bug
description: "Something isn't working"
color: 'd73a4a'
- name: enhancement
description: New feature or request
color: '#a2eeef'
- name: question
description: Information is requested
color: '#d876e3'
## Others
- name: duplicate
description: This already exists
color: '#cfd3d7'
- name: good first issue
description: Good for newcomers
color: '#7057ff'
- name: help wanted
description: Extra attention is needed
color: '#008672'
- name: invalid
description: "This doesn't seem right"
color: '#e4e669'
# Custom
- name: automated
description: Created by an automation
color: '#000000'
- name: "can't reproduce"
color: '#e95f2c'
- name: customer-requested
description: Was requested by a customer of us
color: '#068374'
- name: stale
color: '#ededed'
- name: waiting-for-response
description: If no response is received after a certain time the issue will be closed
color: '#202020'
43 changes: 43 additions & 0 deletions .github/workflows/broken-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Broken links

on:
workflow_dispatch:
schedule:
- cron: "23 23 * * 0"

permissions:
issues: write

jobs:
link-checker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- run: mv .github/.lycheeignore .lycheeignore

- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v1

- name: Find already existing issue
id: find-issue
run: |
echo "number=$(gh issue list -l 'bug' -l 'automated' -L 1 -S 'in:title \"Link Checker Report\"' -s 'open' --json 'number' --jq '.[].number')" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ github.token }}

- name: Close issue if everything is fine
if: env.lychee_exit_code == 0 && steps.find-issue.outputs.number != ''
run: gh issue close -r 'not planned' ${{ steps.find-issue.outputs.number }}
env:
GH_TOKEN: ${{ github.token }}

- name: Create Issue From File
if: env.lychee_exit_code != 0
uses: peter-evans/create-issue-from-file@v5
with:
issue-number: ${{ steps.find-issue.outputs.number }}
title: Link Checker Report
content-filepath: ./lychee/out.md
labels: bug, automated
Loading

0 comments on commit 397652c

Please sign in to comment.