repo string | pull_number int64 | instance_id string | issue_numbers list | base_commit string | patch string | test_patch string | problem_statement string | hints_text string | created_at timestamp[ns, tz=UTC] | version float64 |
|---|---|---|---|---|---|---|---|---|---|---|
checkstyle/checkstyle | 14,553 | checkstyle__checkstyle-14553 | [
"11340"
] | d667c38174c32d2f2fc3cac16ef4a4bd2a978f9f | diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterNumberTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterNumberTest.java
--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterNumberTest.java
+++ b/src/it/java/org/checkst... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java
+++ b/src/test/java/com/puppycra... | Add ignoreAnnotatedBy property to ParameterNumberCheck
Check name: [ParameterNumberCheck](https://checkstyle.org/config_sizes.html#ParameterNumber)
https://checkstyle.org/checks/sizes/parameternumber.html#ParameterNumber
## Problem
https://www.baeldung.com/jackson-annotations#1-jsoncreator
https://fasterxml.g... | Nice!
Supression of constructors with this annotation can be achieved via [SuppresionXpathSingleFilter](https://checkstyle.sourceforge.io/config_filters.html#SuppressionXpathSingleFilter):
```
➜ java cat Test.java
public class Test {
private final String a1;
private final String a2;
private final ... | 2024-02-26T17:17:57Z | 10.14 |
checkstyle/checkstyle | 14,497 | checkstyle__checkstyle-14497 | [
"14344"
] | 49d5c0d7ae601be805d52890a821404266630d27 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheck.java
+++ b/src/main/java/com... | diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/GenericWhitespaceTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/GenericWhitespaceTest.java
--- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizont... | GenericWhitespace Check ignores exception to the ">" rule for succeeding whitespaces
Detected at [#14341](https://github.com/checkstyle/checkstyle/pull/14341).
Affects PR #14364
([Documentation](https://checkstyle.org/checks/whitespace/genericwhitespace.html))
**Test.java**
```java
import java.util.ArrayList;... | @sktpy , I understand that the Checkstyle style mentions the said violation and the same has not been implemented. But does the Sun Java style guide and the Google Java Style Guide also include the whitespace as a violation?? If yes, please attach a snapshot of the rule for reference. If not, perhaps that is why the vi... | 2024-02-17T10:21:59Z | 10.13 |
checkstyle/checkstyle | 13,667 | checkstyle__checkstyle-13667 | [
"13666"
] | acecbd4d7ec4a20c1c1130dfcdd8823e01ae3a8a | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.java
+++ b/src/main/java/... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsPagesTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsPagesTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsPagesTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsPagesTes... | Assert that properties are ordered alphabetically in xdoc
As suggested in https://github.com/checkstyle/checkstyle/pull/13407#discussion_r1309128616
We need to rearrange properties in alphabetical order(xdoc and javadoc since they are connected) and add a test for that. This will ease reviews when applying the prope... | Do we still want to keep `tokens`/`javadocTokens` at the end or do we want true alphabetical order? | 2023-08-30T08:31:36Z | 10.12 |
checkstyle/checkstyle | 13,357 | checkstyle__checkstyle-13357 | [
"13134"
] | f4a33f90bf8eda8ef2cdf7f66fd60878d2aa1736 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.java
+++ b/src/main/java/com/puppy... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsJavaDocsTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsJavaDocsTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsJavaDocsTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/Xdoc... | Implement examples macro and xdoc template parser
All xdoc examples are being moved to real java tests in https://github.com/checkstyle/checkstyle/issues/13100
The purpose of this issue is to gather requirements on how this parser should work and then implement it after an agreement is achieved.
- There is a prop... | My vision would be to have some custom check and listener (comment aware of course) that does the following:
1. Grabs config comment and extracts xml
2. Transforms the AST based on some properties defined within our generation system
3. Ties into listener that grabs data we need
Listener would provide data we nee... | 2023-07-04T12:31:48Z | 10.12 |
checkstyle/checkstyle | 13,320 | checkstyle__checkstyle-13320 | [
"12155"
] | 08da65a9f63912571441fde44965b827c4977614 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/ConfigurationLoader.java b/src/main/java/com/puppycrawl/tools/checkstyle/ConfigurationLoader.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/ConfigurationLoader.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/ConfigurationLoader.java
@@ -68,6 ... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java b/src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.ja... | BDD configuration comments should be in XML
Consider:
```bash
~/I/checkstyle/s/t/resources/c/p/t/c/checks/im/importorder master *1 !2 > cat InputImportOrderStaticGroupOrderBottom_Negative2.java
/*
ImportOrder
option = top
groups = org, java
ordered = (default)true
separated = true
separatedStaticGroups = (de... | >Allows us to validate syntax/ format of configuration easily
We already payed a price for this, it is not an issue now.
>Will ease issues where we need multiple modules
We do not want to have complicated configs, issue with filters (where we need few modules) looks like resolved.
>Can even allow comments i... | 2023-06-26T20:28:36Z | 10.12 |
checkstyle/checkstyle | 12,487 | checkstyle__checkstyle-12487 | [
"12486"
] | 8382d882dc9e446238d337b069d2ddce908f7bbc | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck.java
+++ b/src/main/java/com... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java
+++ b/src/t... | NoWhitespaceAfter false positive on synchronized method
Hello,
I have the following checkstyle configuration in `pom.xml`:
```xml
<module name="NoWhitespaceAfter">
<property name="tokens" value="ARRAY_INIT,AT,INC,DEC,UNARY_MINUS,UNARY_PLUS,BNOT,LNOT,DOT,TYPECAST,ARRAY_DECLARATOR,INDEX_OP,LITERAL_SYNCHRONIZE... | @rnveach Oops it seems you edited my comments and I edited them back behind, sorry. Don't hesitate if you think I'm missing some important information.
We ask for issues to reported in our format https://checkstyle.org/report_issue.html#How_to_report_a_bug.3F
@rnveach Thanks. I put back the output you've added previous... | 2022-12-02T05:06:55Z | 10.5 |
checkstyle/checkstyle | 12,831 | checkstyle__checkstyle-12831 | [
"11569"
] | 0b832630aa4c9d841e86f5283e76f25caea1afa7 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/ClassMemberImpliedModifierCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/ClassMemberImpliedModifierCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/ClassMemberImpliedModifierCheck.java
++... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/ClassMemberImpliedModifierCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/ClassMemberImpliedModifierCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/ClassMemberImpliedModifierCheck... | A false negative about the rule ClassMemberImpliedModifier
I have read check documentation: https://checkstyle.sourceforge.io/config_modifier.html#ClassMemberImpliedModifier
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, ... | I'm on it. | 2023-03-12T19:24:51Z | 10.9 |
checkstyle/checkstyle | 12,516 | checkstyle__checkstyle-12516 | [
"12507"
] | a671904137010568625930b0c105528db46914a8 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java b/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java
@@ -1952,14 +1952,20 @@ publi... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheckTest.java
+++ b/src/test/java/com/pu... | Support record patterns (preview-feature in Java 19) as described by JEP 405
**How it works Now:**
**Compilation works**
```bash
javac --release 19 --enable-preview Example.java
Note: Example.java uses preview features of Java SE 19.
Note: Recompile with -Xlint:preview for details.
```
**The source file**
... | I am on it.
@apflieger , can we ask you to try workaround while fix is in progress ?
please try to apply this update to your config - https://github.com/checkstyle/checkstyle/issues/12542#issuecomment-1365367872
it should allow you to use new features without being blocked by checkstyle. Please share feedback.
It w... | 2022-12-10T16:28:02Z | 10.11 |
checkstyle/checkstyle | 12,444 | checkstyle__checkstyle-12444 | [
"12443"
] | 3f31f9f303f38d86242bd4ecf67662ab2f2899a8 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/AutomaticBean.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/AutomaticBean.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AutomaticBean.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AutomaticBean.java
@@ -361,7 +361,7 ... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java
+++ b/src/test/java/com/puppycrawl/tools/... | checkstyle 10.3.3 and newer throws NullPointerException on annotated generic types from IllegalType rule
I minimized my repro to narrow down the cause.
The config:
`❯ /bin/cat checkstyle-configuration.xml`
```xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configurat... | This issue is tied to https://github.com/checkstyle/checkstyle/issues/12017 and commits https://github.com/checkstyle/checkstyle/commit/308001394030b0ba52921dd8f1b0bef22c90ea83 and https://github.com/checkstyle/checkstyle/commit/01b7de64e59c5932a13f4936c2f2355bb56603ec and PRs https://github.com/checkstyle/checkstyle/p... | 2022-11-23T04:52:55Z | 10.4 |
checkstyle/checkstyle | 12,105 | checkstyle__checkstyle-12105 | [
"12104"
] | fa6856985e3eb32f11ae63e56c19fc2181a50d06 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java b/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java
@@ -431,7 +431,7 @@ public void fireFileFinished(String f... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java
@@ -491,7 +491,7 @@ public void testFinis... | Remove Global Static Locale
https://github.com/checkstyle/checkstyle/blob/a368230b7df8ca70839f97d30a8d8adebd8b9ff3/src/main/java/com/puppycrawl/tools/checkstyle/api/Violation.java#L68
https://github.com/checkstyle/checkstyle/blob/a368230b7df8ca70839f97d30a8d8adebd8b9ff3/src/main/java/com/puppycrawl/tools/checkstyle/Ch... | 2022-08-26T14:35:05Z | 10.3 | |
checkstyle/checkstyle | 11,972 | checkstyle__checkstyle-11972 | [
"11720"
] | f4ab4aa20d27153bb9489315644cfb2a4c8b9e3c | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceC... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageD... | Pitest: Kill all surviving mutations
This will be main tracker issue for killing surviving mutations before we begin work in https://github.com/checkstyle/checkstyle/issues/11719
Now that we have diff report generation as github action, let's modify the procedure from https://github.com/checkstyle/checkstyle/issues... | Once we approve this issue, we should close https://github.com/checkstyle/checkstyle/issues/7797 and any child/ associated issues.
approved.
it would be good to see html report(s) where ALL is activated to see visually scope of work. REpost should be on github.io to let mentors review it and discuss at any time and ... | 2022-07-23T18:16:08Z | 10.3 |
checkstyle/checkstyle | 11,517 | checkstyle__checkstyle-11517 | [
"11498"
] | 3103d5256fc518710c0e34ba72a25eb700aa133f | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.java
+++ b/src/main/java/com/puppy... | diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/WhitespaceAfterTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/WhitespaceAfterTest.java
--- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwh... | WhitespaceAfter should support LITERAL_CATCH token
https://checkstyle.org/config_whitespace.html#WhitespaceAfter
I have downloaded the latest cli from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
**How it w... | I am on it. | 2022-04-06T06:56:26Z | 10.1 |
checkstyle/checkstyle | 11,601 | checkstyle__checkstyle-11601 | [
"11588"
] | a96670f797f9db81df85a55abb8cf8bac93e5d15 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/c... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheckTest.java
+++ b/src/test/ja... | Resolve SimplifiableIfStatement inspection violations
Taken from https://github.com/checkstyle/checkstyle/issues/11566
see commit: https://github.com/checkstyle/checkstyle/commit/009cffaae0f1bd79f5c0084f5354f45ed391e346
we need to revert suppression of SimplifiableIfStatement or explain why they should be perman... | On it | 2022-05-03T03:26:33Z | 10.2 |
checkstyle/checkstyle | 11,383 | checkstyle__checkstyle-11383 | [
"11213"
] | d9f7a85713f43960153fb57d95e98bdd22d02176 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java
+++ b/src/main/java/com/puppycrawl/tools/... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheckTest.java
+++ b/src/test/java/com/puppy... | False positive: SummaryJavadocCheck
From [comment1](https://github.com/checkstyle/checkstyle/pull/11051/files#r775167621) and [comment2](https://github.com/checkstyle/checkstyle/pull/11051/files#r775200466)
I have read check documentation: https://checkstyle.sourceforge.io/config_javadoc.html#SummaryJavadoc
I have do... | on it. | 2022-03-09T18:42:49Z | 10 |
checkstyle/checkstyle | 11,264 | checkstyle__checkstyle-11264 | [
"11259"
] | 628a7643aeaa6736bec4c7c38910e5c0ab26aa4f | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java
+++ b/src/main/java/com/puppy... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheckTest.java
+++ b/src/test/ja... | RedundantModifier should include RECORD_DEF in acceptable tokens
Issue property reported by @Vyom-Yadav
I have read check documentation: http://checkstyle.sourceforge.net/config_modifier.html#RedundantModifier
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have... | It would be a good idea to wait for resolution of https://github.com/checkstyle/checkstyle/issues/10798 before working on this issue.
Edit: on second thought, this should not matter, since we are only adding type definition token and checking for static modifier.
@nmancus1 Though both the issues are related to the ... | 2022-01-31T18:49:23Z | 10 |
checkstyle/checkstyle | 11,245 | checkstyle__checkstyle-11245 | [
"11241"
] | 4b568976ada9210363162e64e232a0c67edbdc74 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java
+++ b/src/main/java/... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java
+++ b/sr... | `EmptyLineSeparator`: false negative in Enum and interface fields
I have read check documentation: https://checkstyle.org/config_whitespace.html#EmptyLineSeparator
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli des... | I could reproduce the issue, will fix it soon. | 2022-01-27T20:05:41Z | 9.3 |
checkstyle/checkstyle | 11,482 | checkstyle__checkstyle-11482 | [
"9004"
] | c46bd286bd3d3e3ca133fe3df714aa3b97d35252 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/gui/TreeTable.java b/src/main/java/com/puppycrawl/tools/checkstyle/gui/TreeTable.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/gui/TreeTable.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/gui/TreeTable.java
@@ -30,6 +30,7 @@
import java.ut... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/gui/MainFrameTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/gui/MainFrameTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/gui/MainFrameTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/gui/MainFrameTest.java
@@ -183,7 +183,7 ... | GUI can not find node by simple xpath
```
$ cat Test.java
public class Test {
int i; // warn
int[] arr = {
40, // ok magic reason
47, // ok magic reason
};
}
$ java -jar checkstyle-8.36.2-all.jar -b "/CLASS_DEF" Test.java
CLASS_DEF -> CLASS_DEF [1:0]
```
`java -cp checkstyle-8.... | @romani
I got the problem. The CLASS_DEF AST Node is supported by IDENT[@text='Test']. We cannot mention CLASS_DEF simply as there can be multiple class definitions in a java file. So, we need to also mention IDEN[@text='Test']. So, the correct XPATH Query will be `/CLASS_DEF[./IDENT[@text='Test']]`. We can see this ... | 2022-03-29T03:44:57Z | 10.1 |
checkstyle/checkstyle | 11,173 | checkstyle__checkstyle-11173 | [
"11172"
] | 9e1ff370020786ed45ad2854752b4171d99ce979 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/Main.java b/src/main/java/com/puppycrawl/tools/checkstyle/Main.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/Main.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/Main.java
@@ -102,7 +102,7 @@ private Main() {
*
* @param args the ... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/MainTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/MainTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/MainTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/MainTest.java
@@ -22,8 +22,10 @@
import static com.google.common.t... | Replace System.exit with Runtime.exit
Prerequisite for #9146
Switching to Java11 breaks pitest-main report:

There is one "uncovered" line may be related to https://openjdk.java.net/jeps/181
The bytecode ... | 2022-01-10T06:26:23Z | 9.2 | |
checkstyle/checkstyle | 10,930 | checkstyle__checkstyle-10930 | [
"7504"
] | 55dfdcdec20d3246dd5a0fc5aeac7ce822779e13 | diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedLocalVariableTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedLocalVariableTest.java
new file mode 100644
--- /dev/null
+++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedLocal... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheckTest.java
new file mode 100644
--- /dev/null
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVaria... | New Check: UnusedVariable
I'd like to request an unused variable module. The following should fail:
public void foo() {
Integer bar = 1;
// This should fail since bar is not used
}
Where as:
public Integer foo() {
Integer bar = 1;
return bar
}
Sh... | Agree, this would be useful.
Hello, I would like to work on this issue.
@eriklansner-blip If you are new to checkstyle then I would not recommend this issue as a first time. To be able to see if a variable is used or not would require some degree of tracking the variable in the code. There could be name conflicts like ... | 2021-11-07T05:19:38Z | 9.2 |
checkstyle/checkstyle | 10,958 | checkstyle__checkstyle-10958 | [
"10817"
] | 5bceb5dccf260e338345ba33a5b5154175973979 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/c... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java
+++ b/src/test/java/com/puppycrawl/tools/... | NPE in IllegalTypeCheck when checking a record (Java 14)
Hello,
https://checkstyle.org/config_coding.html#IllegalType
I'm trying JDK 16 with language-level 16 I've run into an NPE. I've discovered this on Checkstyle 9.0, but the same problem is still unresolved on the `master` branch.
Since the build is config... | > fprochazka@0e18223
> NullPointerException
I'm sorry, I am not clearly following the issue from just reading this. From your commit, which input file causes the exception?
The simplest way to report and reproduce an issue is exactly like https://checkstyle.org/report_issue.html#How_to_report_a_bug.3F .
Both `I... | 2021-11-17T16:25:27Z | 9.2 |
checkstyle/checkstyle | 10,904 | checkstyle__checkstyle-10904 | [
"10747"
] | aec751dfba46e7ce6eae351cd93fde43f2cf3105 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/MetadataGeneratorLogger.java b/src/main/java/com/puppycrawl/tools/checkstyle/MetadataGeneratorLogger.java
new file mode 100644
--- /dev/null
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/MetadataGeneratorLogger.java
@@ -0,0 +1,111 @@
+////////////////////... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/MetadataGeneratorLoggerTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/MetadataGeneratorLoggerTest.java
new file mode 100644
--- /dev/null
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/MetadataGeneratorLoggerTest.java
@@ -0,0 +1,112 @@
+////////... | JavadocMetadataScraper fails silently if it can't write the XML files
Identified through https://github.com/sevntu-checkstyle/sevntu.checkstyle/issues/857 ,
At https://github.com/checkstyle/checkstyle/blob/13481f2c410e4944ecf5ab93ec49948a523a0c82/src/main/java/com/puppycrawl/tools/checkstyle/meta/XmlMetaWriter.java#... | I am working on it.
The issue is split into 2 PRs. The first will add the error message to the module. The second will have the util print out the errors to the user when it is run.
@Vyom-Yadav, what is left to be done ?
@romani, Currently the error messages will not be shown to users as `JavadovMetadataScraper` is not... | 2021-10-25T07:40:08Z | 9.3 |
checkstyle/checkstyle | 10,922 | checkstyle__checkstyle-10922 | [
"10920"
] | 2a6a18a31978aa468db669b564929efd00c321c4 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheck.java
+++ b/src/main/java/... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheckTest.java
+++ b/sr... | Version 9.x reports NoWhitespaceBefore error on semicolon or comma after string with emoji
I have read check documentation: https://checkstyle.org/config_whitespace.html#NoWhitespaceBefore
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and sh... | it looks similar to https://github.com/checkstyle/checkstyle/issues/10837, @nmancus1 can you help? | 2021-11-04T04:40:22Z | 9.1 |
checkstyle/checkstyle | 10,857 | checkstyle__checkstyle-10857 | [
"10855"
] | 696902eb962e1e3ab5c98be82ce360860dd49839 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java
+++ b/src/main/java/com/puppycrawl/tools/che... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java
+++ b/src/test/java/com/puppycra... | UnusedImports error if there are only array references to a given class
```bash
slovdahl@desk:~/checkstyle-unused-import-bug-reproducer/src/main/java (main)$ javac checkstyle/reproducer/UnusedImportBug.java
slovdahl@desk:~/checkstyle-unused-import-bug-reproducer/src/main/java (main)$
slovdahl@desk:~/checkstyle-u... | AST:
```
COMPILATION_UNIT -> COMPILATION_UNIT [1:0]
|--IMPORT -> import [1:0]
| |--DOT -> . [1:16]
| | |--DOT -> . [1:11]
| | | |--IDENT -> java [1:7]
| | | `--IDENT -> util [1:12]
| | `--IDENT -> HashMap [1:17]
| `--SEMI -> ; [1:24]
|--IMPORT -> import [2:0]
| |--DOT -> . [2:16]
|... | 2021-10-11T18:05:43Z | 9 |
checkstyle/checkstyle | 10,762 | checkstyle__checkstyle-10762 | [
"10760"
] | 1acbabe78a6f9a3423b59cdb9b04dec74657b7be | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/Violation.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/Violation.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/api/Violation.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/Violation.java
@@ -528,7 +528,7 @@ public Resour... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTaskTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTaskTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTaskTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAn... | Add maven modernizer plugin
Plugin link https://github.com/gaul/modernizer-maven-plugin
It may be useful, especially for migration to java 11.
Cons - some checks can be duplicated by other tools.
I have added plugin, exclusions (test inputs) and fixed 2 violations here - https://github.com/strkkk/checkstyle/comm... | Sure, if project is configurable enough and it can find something , let's use it.
We need to catch up our goal to use all tools of static analysis, to show them in action, and actually benefit from them.
Please don't forget to add `<modernizer.skip>true</>` to [no-validations](https://github.com/checkstyle/checkstyle/... | 2021-08-30T12:59:54Z | 9 |
checkstyle/checkstyle | 10,280 | checkstyle__checkstyle-10280 | [
"10272"
] | e28abc7d49a5f176c59b30b7d8d680339215ac29 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/CheckstyleParserErrorStrategy.java b/src/main/java/com/puppycrawl/tools/checkstyle/CheckstyleParserErrorStrategy.java
new file mode 100644
--- /dev/null
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/CheckstyleParserErrorStrategy.java
@@ -0,0 +1,41 @@
+///... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/AstTreeStringPrinterTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/AstTreeStringPrinterTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/AstTreeStringPrinterTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/AstTreeStringPrinte... | Upgrade Java Grammar from ANTLR2 to ANTLR4
From https://github.com/checkstyle/checkstyle/wiki/Checkstyle-GSoC-2021-Project-Ideas#project-name-upgrade-java-grammar-from-antlr2-to-antlr4:
> Checkstyle needs to have new Java grammar that is based on ANTLR4 version. This task is very difficult but it is critical for Che... | There are a couple of cases where Checkstyle can currently parse non-compilable files:
[Example 1](https://github.com/INRIA/spoon/blob/master/src/test/resources/executable-reference/Foo.java)
reason for not compiling - missing semicolon on line 7.
[Example 2](https://github.com/INRIA/spoon/blob/spoon-core-8.0.... | 2021-07-07T21:29:19Z | 8.45 |
checkstyle/checkstyle | 10,216 | checkstyle__checkstyle-10216 | [
"10208"
] | b464b2501e23fb63b7c6d49f7f1f28759c55b996 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.java b/src/main/java/com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/JavadocDetailNodeParse... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammar/CrAwareLexerTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammar/CrAwareLexerTest.java
new file mode 100644
--- /dev/null
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammar/CrAwareLexerTest.java
@@ -0,0 +1,83 @@
+//////////////////... | Javadoc parser/grammar doesn't report the correct lines in Javadoc AST.
Identified at https://github.com/checkstyle-antlr4/checkstyle-antlr4/issues/15, ANTLR doesn't support the `\r` (pre-OSX macos) line ending any longer, and has no plans to add support. Therefore, when parsing a Javadoc in a file that uses the `\r` l... | 2021-06-28T16:10:27Z | 8.44 | |
checkstyle/checkstyle | 9,942 | checkstyle__checkstyle-9942 | [
"9941"
] | 5738af2e9aa34f5a7e66fe5bb412aa7b5d0345ab | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/DetailAST.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/DetailAST.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/api/DetailAST.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/DetailAST.java
@@ -90,13 +90,13 @@ public interf... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheckTest.java
+++ b/src/test/java/com/puppycra... | AtclauseOrder: Falsely ignores method with annotation
Identified at https://github.com/checkstyle/checkstyle/pull/9939
````
$ cat TestClass.java
public class TestClass {
/**
* Test.
*
* @deprecated Test.
* @param type Test.
* @return Test.
*/
@Deprecated
public bo... | https://github.com/checkstyle/checkstyle/blob/13481f2c410e4944ecf5ab93ec49948a523a0c82/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheck.java#L267-L277
Issue is method returns the annotation definition instead of the method definition. The code wrongly believes we are looking at an annota... | 2021-04-27T07:13:48Z | 8.43 |
checkstyle/checkstyle | 9,759 | checkstyle__checkstyle-9759 | [
"8971"
] | 96a383ba3cea293e29c1bde4abce8c6885abe827 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheck.java
+++ b/src/main/ja... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheckTest.java
+++ b... | ExecutableStatementCount should allow LAMBDA token
from discussion at https://github.com/checkstyle/checkstyle/issues/8966
https://checkstyle.org/config_sizes.html#ExecutableStatementCount
```
$ javac Test.java
$ cat Test.java
public class Test {
java.util.function.Consumer a = (o) -> {
o.toString()... | abandoned PR - https://github.com/checkstyle/checkstyle/pull/9067 , everyone is welcome to pickup code from this PR and create new PR to fix issue. | 2021-03-29T14:42:58Z | 8.42 |
checkstyle/checkstyle | 9,728 | checkstyle__checkstyle-9728 | [
"8186"
] | baa2894516d47ee9aca623a7414473f75fedac39 | diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoWhitespaceBeforeCaseDefaultColonTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoWhitespaceBeforeCaseDefaultColonTest.java
new file mode 100644
--- /dev/null
+++ b/src/it/java/org/checkstyle/suppressionxpathfil... | diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/NoWhitespaceBeforeCaseDefaultColonTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/NoWhitespaceBeforeCaseDefaultColonTest.java
new file mode 100644
--- /dev/null
+++ b/src/... | new Check: NoWhitespaceBeforeCaseDefaultColon
The idea of this check originates from https://github.com/checkstyle/checkstyle/issues/8045
This check should report whitespaces before colon token of switch cases and default.
```
cat Test.java
class Test {
{
switch(1) {
case 1 : // expected violation
bre... | Also, no whitespace is expected in [LabeledStatements](https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-LabeledStatement):
```java
outer: for(;;) {
for(;;) {
break outer;
}
}
```
If we come up with a good name, we can also handle them.
@pbludov, we handle this already.
See Issue htt... | 2021-03-26T20:42:44Z | 8.44 |
checkstyle/checkstyle | 9,539 | checkstyle__checkstyle-9539 | [
"8179"
] | d728b6e43bf8d8459bfcecd1c9187c52883a298e | diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyLineSeparatorTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyLineSeparatorTest.java
--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyLineSeparatorTest.java
+++ b/src/it/java/or... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java
+++ b/sr... | EmptyLineSeparator: Inability to use xpath for violation on empty line
Split from #7956
https://github.com/checkstyle/checkstyle/blob/a8a90cf2423c27fb3fe227fc1906fdfc255f5d9b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java#L419
There is no AST node associated an empty line... | it is not critical on what node to print violation as in java you always have some character after - end of class scope. It would be good to report on previous token always, as we always know it existed and we do NOT know what will be on next line, this will be more reliable approach I think.
@romani it' ok to move vio... | 2021-03-15T09:02:04Z | 8.41 |
checkstyle/checkstyle | 9,744 | checkstyle__checkstyle-9744 | [
"9315"
] | 625a85ca14a10a2ee1b9760945cf7473d0538677 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagContinuationIndentationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagContinuationIndentationCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagContinuationIndent... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagContinuationIndentationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagContinuationIndentationCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagContinuati... | JavadocTagContinuationIndentation does not check text inside HTML elements
From https://github.com/checkstyle/checkstyle/pull/8177#discussion_r579386002
Check documentation: https://checkstyle.org/config_javadoc.html#JavadocTagContinuationIndentation
```cmd
D:\checkstyletest>type config.xml
<?xml version="1.0"?... | @romani I want to work on this.
> if this is considered a bug
is this a bug? or do I need to update the documentation?
it is bug,
nor now, I do not think we need to update docuemntation | 2021-03-28T18:25:36Z | 8.45 |
checkstyle/checkstyle | 9,370 | checkstyle__checkstyle-9370 | [
"9010"
] | 3124419d3dbe26f6269ed84ae98b601e7e95898b | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/Tra... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheckTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyl... | TrailingComment report violation on comment at the begining of line
detected at https://github.com/checkstyle/checkstyle/pull/8711
detected problem:
```
/*package*/ void setAutoflush(boolean autoflush) {
this.autoflush = autoflush;
}
```
There should be no violation on this code
We nee... | I am on it
I am on it. | 2021-03-11T04:05:12Z | 8.41 |
checkstyle/checkstyle | 9,209 | checkstyle__checkstyle-9209 | [
"9204"
] | 23c7f55794fbe0b3e46e95b988d6874a466ebf47 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingLeadingAsteriskCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingLeadingAsteriskCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingLeadingAsteriskCheck.j... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/meta/MetadataGeneratorUtilTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/meta/MetadataGeneratorUtilTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/meta/MetadataGeneratorUtilTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/m... | Metadata generation fails on line wrapped type description
Discovered at https://github.com/checkstyle/checkstyle/pull/9076#discussion_r559056728, when a check's class level javadoc property description is line wrapped in mid-sentence, metadata generation is incomplete.
From https://github.com/checkstyle/checkstyl... | 2021-01-25T12:34:04Z | 8.39 | |
checkstyle/checkstyle | 9,261 | checkstyle__checkstyle-9261 | [
"9236"
] | c312f7571c1aaded5465c35b0047e946feabfd56 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/chec... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java
+++ b/src/test/java/com/pu... | Regression in IndentationCheck 8.40 regarding the white spaces needed in a second line of a try/resource declaration
https://checkstyle.org/config_misc.html#Indentation
$ javac Test.java
successful compilation
$ Test.java
```java
import java.io.*;
class Test {
void test() {
try (InputStrea... | @tmortagne Please edit your post to follow template https://checkstyle.org/report_issue.html#How_to_report_a_bug.3F
we did regression in xwiki code base that is not part of our execution :( we use xwiki-common but problem is in xwiki-platform.
@Abhishek-kumar09 , can you take a look ?
@romani do you want me to try ... | 2021-02-08T15:22:04Z | 8.4 |
checkstyle/checkstyle | 9,018 | checkstyle__checkstyle-9018 | [
"8933"
] | 79f8ffca08fdca9f844ff8ebac6be4fd697b6dc6 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/c... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java
+++ b/src/test/java/com/puppycrawl/tools/... | IllegalType: inability to set default value for property memberModifiers
Check documentation: https://checkstyle.org/config_coding.html#IllegalType
```
$ cat Test.java
public class Test {
private Optional<String> field1;
}
$ cat config.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//... | 2020-11-24T12:09:00Z | 8.38 | |
checkstyle/checkstyle | 8,984 | checkstyle__checkstyle-8984 | [
"8957"
] | 1f38561218e5be40a8e8ace134f5fca1c9415c15 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java
+++ b/src/main/java/... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java
+++ b/sr... | EmptyLineSeparator flags commas for multiple single type variables on line
**Check documentation:** https://checkstyle.org/config_whitespace.html#EmptyLineSeparator
```
/var/tmp $ javac Test.java
/var/tmp $ cat Test.java
public class Test {
int readOnly;
int p01;
int p11;
int q01, q02, q03... | 2020-11-13T11:36:31Z | 8.37 | |
checkstyle/checkstyle | 8,913 | checkstyle__checkstyle-8913 | [
"8895"
] | dfec36a68198f335475976c47ca7c4f2dd553603 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java
+++ b/src/main/java/com/puppycra... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java
+++ b/src/test/java/... | FinalLocalVariable: NPE in records
Check documentation: https://checkstyle.org/config_coding.html#FinalLocalVariable
problem was detected during https://github.com/checkstyle/contribution/commit/529fc836f88e0f88148ab7760a5ec7ba4d100715
`**/resources-noncompilable/**/checks/metrics/cyclomaticcomplexity/InputCyclomat... | @anhminhtran235 , can you help us to resole this issue ?
@romani Absolutely! I am on it.
@romani Is this the 2nd NPE found after the fact because of our ignore list? Maybe we should run regression on everything to see if there is anything else.
Please suggest how to run to detect only exceptions. Right now ignore list ... | 2020-10-21T20:52:22Z | 8.36 |
checkstyle/checkstyle | 8,907 | checkstyle__checkstyle-8907 | [
"6346"
] | 1d500f05b91773a40e35cac884eb697c661ec5a6 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.java
+++ b/src/main/java/... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java
+++ b/sr... | ClassFanOutComplexity: false positive on var
Taken from https://github.com/checkstyle/checkstyle/issues/6316#issuecomment-451522961
````
$ cat TestClass.java
public class TestClass {
void method() {
var x = 1;
}
}
$ cat TestConfig.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Pu... | @rnveach
This check should ignore `var` completely?
if not, issue requires clarification - if right side is, for example, a method invocation
```
var myVar = godKnowsWhatThisMethodReturns();
```
I guess we cannot infer type here.
The only case when we know type is a String/int/char/etc. literal on right side.... | 2020-10-20T09:03:14Z | 8.36 |
checkstyle/checkstyle | 8,720 | checkstyle__checkstyle-8720 | [
"8726"
] | 3ee42d3deb541e191cf270aa6027a5cec137649e | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/Des... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsPagesTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsPagesTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsPagesTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsPagesTes... | Mofication of module property default values to reflect actual working data
Some check properties have default values which wont work when copy-pasted in module configurations.
For example:
`null`: https://github.com/checkstyle/checkstyle/blob/6f58247b85ff4d74eb22dbd8c51d72b69fe51839/src/main/java/com/puppycrawl/tool... | 2020-08-19T21:52:51Z | 8.35 | |
checkstyle/checkstyle | 8,420 | checkstyle__checkstyle-8420 | [
"8394"
] | f5cfb9e3c9d141d98bb480c900ebcc320a9f281c | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checks... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheckTest.java
+++ b/src/test/java/com/puppycrawl/... | InnerTypeLast should handle ctors and static init blocks
https://checkstyle.sourceforge.io/config_design.html#InnerTypeLast
From the Check description:
>> Checks nested (internal) classes/interfaces are declared at the bottom of the primary (top-level) class after all method and field declarations.
It is a bit... | I agree ctors should be included. I question static ctors and instance ctors without the method declaration (just `{}`), but I think it does make some sense they are included too. | 2020-07-08T15:11:33Z | 8.34 |
checkstyle/checkstyle | 8,273 | checkstyle__checkstyle-8273 | [
"8266"
] | 7b55584d331154daf37ab8f56b83be2951ef263f | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocMethodCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocMethodCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocMethodCheck.java
+++ b/src/main/java/com... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocMethodCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocMethodCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocMethodCheckTest.java
+++ b/src/t... | MissingJavadocMethod flagging private methods even target scope is public methods only
https://checkstyle.sourceforge.io/config_javadoc.html#MissingJavadocMethod
```
$ javac CheckstylePrivateMethodTest.java
$
```
```
$ cat config.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DT... | @ChrisTrenkamp Please correct your config example to only one failing check.
Issue is in line
https://github.com/checkstyle/checkstyle/blob/6275303e6b5fd4d5e9a6504b390efd0e4aee564d/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocMethodCheck.java#L453-L455
interfaces can have private metho... | 2020-05-29T14:46:23Z | 8.33 |
checkstyle/checkstyle | 8,103 | checkstyle__checkstyle-8103 | [
"7736"
] | 2a7aff864ca7a7c5ef14030bb702d8f48a59953d | diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInterfaceMemberImpliedModifierTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInterfaceMemberImpliedModifierTest.java
new file mode 100644
--- /dev/null
+++ b/src/it/java/org/checkstyle/suppressionxpathfilter/Xpat... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XpathRegressionTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XpathRegressionTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XpathRegressionTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/interna... | Update AbstractChecks to log DetailAST - InterfaceMemberImpliedModifier
Child of https://github.com/checkstyle/checkstyle/issues/5777
This issue specifically focuses on InterfaceMemberImpliedModifier.
| i am on it
@romani @rnveach can you help me to resolve this issue.
I read bit about Xpath and about checkstyle filter from https://checkstyle.org/config_filters.html but didn't get much idea.
@pkpale Look at work done by other contributors for similar issues and it will give you an idea of what needs to be done. htt... | 2020-04-15T08:21:15Z | 8.31 |
checkstyle/checkstyle | 8,127 | checkstyle__checkstyle-8127 | [
"3201"
] | c473838188f35321b53b602fecd19630eec2be39 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheck.java
+++ b/src/main/java/com/puppycra... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheckTest.java
+++ b/src/test/java/... | Allow to configure if ArrayTrailingComma should ignore single-line arrays
Currently the [ArrayTrailingComma](http://checkstyle.sourceforge.net/config_coding.html#ArrayTrailingComma) automatically ignores inline declarations. So using a configuration such as:
``` xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
... | connection with @unrealwork is lost, PR is closed as incomplete.
If smb want to continue from scratch or from where @unrealwork is finished, please be welcome .
@jsotuyod ,
we got PullRequest with fix for your issue, so it bring my attention back to this issue.
can you provide more details on why it is reasonab... | 2020-04-18T22:33:14Z | 8.32 |
checkstyle/checkstyle | 8,070 | checkstyle__checkstyle-8070 | [
"7767"
] | 65122e39bc3852862d0b55eb3317137893cd3ebb | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionXpathFilter.java b/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionXpathFilter.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionXpathFilter.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/f... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XpathRegressionTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XpathRegressionTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XpathRegressionTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/interna... | move WriteTag Check to list of javadoc Check in XpathSuppressionFilter documentation
~Child of https://github.com/checkstyle/checkstyle/issues/5777~
This issue specifically focuses on WriteTag.
| I am on it | 2020-04-10T21:34:09Z | 8.31 |
checkstyle/checkstyle | 8,008 | checkstyle__checkstyle-8008 | [
"7925"
] | b284d53b95138c3dad37c9ac04dfc6a5a99286cd | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java
+++ b/src/main/java/com/puppycrawl/tools/che... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheckTest.java
+++ b/src/test/java/com/puppycra... | Resolve Pitest Issues - JavadocMethodCheck (4)
Child issue of https://github.com/checkstyle/checkstyle/issues/7797 ,
https://github.com/checkstyle/checkstyle/blob/f9131f9536c71d963c83aab1550b7a0371aa9ff5/.ci/pitest.sh#L185
| 2020-04-01T11:46:37Z | 8.32 | |
checkstyle/checkstyle | 7,899 | checkstyle__checkstyle-7899 | [
"5969",
"7675"
] | 18b792ebc5b6d5a2d427ccf61a45b122ba90ff53 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LambdaHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LambdaHandler.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LambdaHandler.java
+++ b/src/main/java/com/puppycrawl/tools/checks... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java
+++ b/src/test/java/com/pu... | Indentation violation for lambda depends on tab symbols in code
ATTENTION: code with tab symbols.
```
/tmp $ javac Test.java
/tmp $ cat config.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<mod... |
This looks like a bug to me from the information I am seeing, but indentation is always tricky.
Lambda does not start the line and should not have been the one reporting the problem if the indentation was wrong. I would expect the `.` or referenced the message call to be where the failure message to be.
Duplicate o... | 2020-03-19T05:11:48Z | 8.3 |
checkstyle/checkstyle | 7,894 | checkstyle__checkstyle-7894 | [
"7128"
] | 5a87cb59188b2e6e334b8787f5a878ddf2b29c0d | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java
+++ b/src/main/java/com/puppycra... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheckTest.java
+++ b/src/test/java/... | CustomImportOrderCheck.customImportOrderRules does not support the default value
https://checkstyle.org/config_imports.html#CustomImportOrder
In this example:
```
<property name="customImportOrderRules"
value="${checkstyle.customimportorder.customimportorderrules}" default="{}"/>
```
I am trying to allow users... | https://github.com/checkstyle/checkstyle/blob/master/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsPagesTest.java#L1095
`{}` is used to represent an empty list, and not necessarily the value for the property. `customImportOrderRules` is converted to a list of strings from the single string you provide it... | 2020-03-18T14:53:09Z | 8.31 |
checkstyle/checkstyle | 7,853 | checkstyle__checkstyle-7853 | [
"7726"
] | 341ef2d7296242b03bff99f37454784ccea82906 | diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidStaticImportTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidStaticImportTest.java
new file mode 100644
--- /dev/null
+++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidStaticImpo... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheckTest.java
+++ b/src/test/java/... | Update AbstractChecks to log DetailAST - AvoidStaticImport
Child of https://github.com/checkstyle/checkstyle/issues/5777
This issue specifically focuses on AvoidStaticImport .
| I am on it
| 2020-03-15T15:46:14Z | 8.3 |
checkstyle/checkstyle | 7,851 | checkstyle__checkstyle-7851 | [
"7768"
] | dfc5efc22bdf5924f5a99760179e43f291eca7ec | diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java
new file mode 100644
--- /dev/null
+++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLoc... | diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule485annotations/AnnotationLocationTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule485annotations/AnnotationLocationTest.java
--- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule485annotations/AnnotationLo... | Update AbstractChecks to log DetailAST - AnnotationLocation
Child of https://github.com/checkstyle/checkstyle/issues/5777
This issue specifically focuses on AnnotationLocation .
| I am on it.
Hi @romani,
As per my understanding, the requirement is to overload the log function in the AnnotationLocationCheck providing AST. However, I feel like I am missing something. Could you clarify a little on what should be done?
Thanks.
@Malintha1996 All checks call a log method to report violations. Th... | 2020-03-14T20:44:46Z | 8.3 |
checkstyle/checkstyle | 7,798 | checkstyle__checkstyle-7798 | [
"7752"
] | ddde906ef9d6e00796414434e59eee7fa9146715 | diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoFinalizerTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoFinalizerTest.java
new file mode 100644
--- /dev/null
+++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoFinalizerTest.java
@@ -0,... | diff --git a/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/NoFinalizerTest.java b/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/NoFinalizerTest.java
--- a/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/NoFinalizerTest.j... | Update AbstractChecks to log DetailAST - NoFinalizer
Child of https://github.com/checkstyle/checkstyle/issues/5777
This issue specifically focuses on NoFinalizer.
| I am on it. | 2020-03-08T17:09:37Z | 8.3 |
checkstyle/checkstyle | 7,193 | checkstyle__checkstyle-7193 | [
"7329"
] | baa250c454de5845151b64ae940173744f4d0435 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java b/src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java
@@ -39,7 +39,... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/ClassResolverTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/ClassResolverTest.java
deleted file mode 100644
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/ClassResolverTest.java
+++ /dev/null
@@ -1,11... | Remove properties related to class loading from JavadocMethod
part of #7116 .
We need to remove from Check any attempt to use classloader to validate source code.
Checkstyle cannot make this reliably and it is whole tool limitation for now - https://checkstyle.org/writingchecks.html#Limitations
**Migration Note... | 2019-10-13T14:15:24Z | 8.27 | |
checkstyle/checkstyle | 7,172 | checkstyle__checkstyle-7172 | [
"7161"
] | 44485ef5ce629ad13f6bcecd0cf0298bb0e26439 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/chec... | diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/RightCurlyTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/RightCurlyTest.java
--- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/RightCurlyTest.java... | ENUM_DEF token support in RightCurlyCheck
Currently RightCurly accepts a lot less tokens (13 tokens) than LeftCurly ([20 tokens](https://checkstyle.sourceforge.io/config_blocks.html#LeftCurly_Properties)).
It is unclear if this is just a mistake or if there is some underlying reason. This issue aims at adding support ... | 2019-10-07T16:27:42Z | 8.28 | |
checkstyle/checkstyle | 6,882 | checkstyle__checkstyle-6882 | [
"6879"
] | 6ac55c23b85c4cd874f5ee50aebb70e321b09428 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java b/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java
+++ b/src/main/java/com/puppycrawl/tools/checks... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java
+++ b/src/test/java/com/puppycrawl/... | SuppressionCommentFilter ignores messageFormat when matching on ID
```
$ cat TestClass.java
package com.puppycrawl.tools.checkstyle.filters.suppressioncommentfilter;
public class InputSuppressionCommentFilter {
// CSOFF naming
public int ABC;
// CSON naming
}
$ cat TestConfig.xml
<?xml version=... | 2019-07-08T23:29:19Z | 8.22 | |
checkstyle/checkstyle | 6,567 | checkstyle__checkstyle-6567 | [
"6490"
] | d61dccb3c7fd391506a512dce96a2620a5f93ac3 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.java
+++ b/src/main/java/com/puppycrawl/too... | diff --git a/src/it/java/com/sun/checkstyle/test/chapter6declarations/rule61numberperline/MultipleVariableDeclarationsTest.java b/src/it/java/com/sun/checkstyle/test/chapter6declarations/rule61numberperline/MultipleVariableDeclarationsTest.java
new file mode 100644
--- /dev/null
+++ b/src/it/java/com/sun/checkstyle/tes... | MultipleVariableDeclarations missing from sun style
The rational of the check says the sun style demands this, but it is not part of the sun checks XML.
https://checkstyle.org/config_coding.html#MultipleVariableDeclarations
| https://checkstyle.org/sun_style.html this page is empty, because style guide is not properly created.
Sun config is seriously in unclear state.
One day we will find contributor to make like https://checkstyle.org/google_style.html , but this is a big project https://github.com/checkstyle/checkstyle/wiki/Checkstyle... | 2019-03-12T18:55:41Z | 8.19 |
checkstyle/checkstyle | 6,515 | checkstyle__checkstyle-6515 | [
"6513"
] | bd7621fae3b1b887d46b8a678600db7e6d03185c | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheck.java
+++ b/src/main/java/com/puppycrawl/tools/... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheckTest.java
+++ b/src/test/java/com/puppy... | EmptyCatchBlock check does not work properly with non-system line endings in files
```
/var/tmp $ javac Foo.java
/var/tmp $ cat config.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<mo... | 2019-03-06T03:12:53Z | 8.2 | |
checkstyle/checkstyle | 4,463 | checkstyle__checkstyle-4463 | [
"4449"
] | ecb07add954061f0f92e8477cbbc0a7c6a7afe76 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java b/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java
@... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTaskTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTaskTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTaskTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAn... | CheckstyleAntTask: substitude setConfig(File) with setConfig(String)
Ant's configUrl requires a full URL - relative paths don't work
Background in Issue #3119:
As I understand it, you should be able to specify a relative path (to a resource on the classpath) in the `configUrl` attribute of the Ant task. However I... | interesting that I do not see any "checkstyle" in stacktrace , so resolving to URL is done by ANT completely.
We do load of in sequence that I described at - https://github.com/checkstyle/checkstyle/commit/20506e1ceb2de74c9a85367135be714f8208643f#diff-2be5da6521926564b0fd9efc2fc60390R124
As we use the same config f... | 2017-06-16T21:14:02Z | 7.8 |
checkstyle/checkstyle | 3,366 | checkstyle__checkstyle-3366 | [
"3186"
] | e905a2746ab7765314e2f8e6ce62717f209fd294 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java
+++ b/src/main/java/com/puppycra... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java
+++ b/src/test/java/... | FinalLocalVariableCheck: false positive from multiple and nested conditions
```
$ cat TestClass.java
package test;
public class TestClass {
void method() {
for (int i = 0; i < 2; i++) {
final Object converter = new Object();
final String type = getType();
Object value;
... | It seems like the issue might be with these lines: [FinalLocalVariableCheck.java#L477](https://github.com/checkstyle/checkstyle/blob/eb5b977a475c2240db5efc83aec8973d734895eb/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java#L477) and [FinalLocalVariableCheck.java#L215](https://git... | 2016-07-22T18:01:01Z | 7 |
checkstyle/checkstyle | 1,485 | checkstyle__checkstyle-1485 | [
"1349"
] | ee33ed57cd2c88888e9821a2047f587f07283d98 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.java
+++ b/src/main/java/com/puppy... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java
+++ b/src/test/java/com/pu... | Indentation on annotation parameters is wrong
When using `<property name="tabWidth" value="4"/><module name="Indentation"/>`, during build checkstyle 6.8.1 complains about:
```
@Cascade(
org.hibernate.annotations.CascadeType.DELETE_ORPHAN
)
```
with:
```
ClickConfig.java:77: ')' have incorrect indent... | 2015-07-26T21:19:09Z | 6.14 | |
checkstyle/checkstyle | 1,399 | checkstyle__checkstyle-1399 | [
"1421"
] | c09131defe36dde56b2d9767d1953d93e20bd200 | diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyl... | diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java
+++ b/src/test/java/com/puppycrawl/too... | JavadocType ignores param tags in InnerClass
Inner classes are not checked with JavadocType check for missing or extra `@param` tags
The following code is Ok, but `@param` tags are wrong set in the javadoc
``` java
/**
* Example inner class.
* @param <A> documented parameter
* @param <C> extra para... | 2015-07-17T09:32:07Z | 6.8 | |
iamkun/dayjs | 2,369 | iamkun__dayjs-2369 | [
"2364"
] | f0a0b546b074b3b511c2319a1ce83d412894b91f | diff --git a/src/plugin/duration/index.js b/src/plugin/duration/index.js
--- a/src/plugin/duration/index.js
+++ b/src/plugin/duration/index.js
@@ -198,7 +198,7 @@ class Duration {
} else {
base = this.$d[pUnit]
}
- return base === 0 ? 0 : base // a === 0 will be true on both 0 and -0
+ return bas... | diff --git a/test/plugin/duration.test.js b/test/plugin/duration.test.js
--- a/test/plugin/duration.test.js
+++ b/test/plugin/duration.test.js
@@ -186,6 +186,12 @@ describe('Add', () => {
expect(a.add({ days: 5 }).days()).toBe(6)
})
+describe('Add to a dayjs()', () => {
+ const a = dayjs()
+ const b = dayjs.dur... | dayjs add duration returns Invalid Date
**Describe the bug**
dayjs().add(dayjs.duration({ "hours" : 7, "minutes" : 10) }))
returns "invalid Date"
only "hours" and "minutes" are in the duration object
dayjs.duration(7, "hours").add(10, "minutes") is working
**Information**
- Day.js Version 1.11.9
- Tim... | Can reproduce after upgrading from 1.11.7 to 1.11.9.
Example usage
```
dayjs.extend(duration)
dayjs.extend(utc)
dayjs.extend(objectSupport)
// Invalid Date
dayjs.utc({ hours: 11, minutes: 30, seconds: 0} ).add(dayjs.duration({ hours: 11, minutes: 0, seconds: 0 })
```
I've used `dayjs().add(duration.asSec... | 2023-07-10T12:49:23Z | 1.11 |
iamkun/dayjs | 2,377 | iamkun__dayjs-2377 | [
"2376"
] | f0a0b546b074b3b511c2319a1ce83d412894b91f | diff --git a/src/plugin/duration/index.js b/src/plugin/duration/index.js
--- a/src/plugin/duration/index.js
+++ b/src/plugin/duration/index.js
@@ -139,7 +139,8 @@ class Duration {
let seconds = this.$d.seconds || 0
if (this.$d.milliseconds) {
- seconds += Math.round(this.$d.milliseconds) / 1000
+ ... | diff --git a/test/plugin/duration.test.js b/test/plugin/duration.test.js
--- a/test/plugin/duration.test.js
+++ b/test/plugin/duration.test.js
@@ -77,6 +77,15 @@ describe('Creating', () => {
expect(dayjs.duration(1000.5).toISOString()).toBe('PT1.001S')
expect(dayjs.duration(-1000.5).toISOString()).toBe('-PT1S... | `Duration.toISOString()` fractional seconds still have precision issues with certain values
Problem: originally submitted in #2366 - I didn't completely fix this apparently. I mistakenly assumed I could round the milliseconds value alone, and then add it to the integer of seconds. However Javascript will encounter floa... | 2023-07-14T19:51:39Z | 1.11 | |
iamkun/dayjs | 2,231 | iamkun__dayjs-2231 | [
"2230"
] | e70bee7f840c89ec523b9ac997e5ac621a522726 | diff --git a/src/index.js b/src/index.js
--- a/src/index.js
+++ b/src/index.js
@@ -280,7 +280,7 @@ class Dayjs {
const matches = {
YY: String(this.$y).slice(-2),
- YYYY: this.$y,
+ YYYY: Utils.s(this.$y, 4, '0'),
M: $M + 1,
MM: Utils.s($M + 1, 2, '0'),
MMM: getShort(locale.m... | diff --git a/test/display.test.js b/test/display.test.js
--- a/test/display.test.js
+++ b/test/display.test.js
@@ -260,3 +260,15 @@ it('As JSON -> toJSON', () => {
it('As ISO 8601 String -> toISOString e.g. 2013-02-04T22:44:30.652Z', () => {
expect(dayjs().toISOString()).toBe(moment().toISOString())
})
+
+it('Year... | 'YYYY' results in missing leading zeroes when year <1000
**Describe the bug**
If the year component of a date is less than 1000, the leading zeroes are omitted when trying to format the year with `'YYYY'`.
E.g.:
```js
dayjs(Date.parse('0001-01-01')).format('YYYY-MM-DD') //=> '1-01-01'
dayjs(Date.parse('0010-01... | 2023-02-07T09:19:20Z | 1.11 | |
iamkun/dayjs | 1,571 | iamkun__dayjs-1571 | [
"1569"
] | 755fc8bb1c532eb991459f180eee81367d12016c | diff --git a/src/plugin/customParseFormat/index.js b/src/plugin/customParseFormat/index.js
--- a/src/plugin/customParseFormat/index.js
+++ b/src/plugin/customParseFormat/index.js
@@ -232,7 +232,10 @@ export default (o, C, d) => {
this.$d = parseFormattedInput(date, format, utc)
this.init()
if (pl &... | diff --git a/test/plugin/customParseFormat.test.js b/test/plugin/customParseFormat.test.js
--- a/test/plugin/customParseFormat.test.js
+++ b/test/plugin/customParseFormat.test.js
@@ -5,6 +5,7 @@ import '../../src/locale/ru'
import uk from '../../src/locale/uk'
import '../../src/locale/zh-cn'
import customParseFormat... | Parsing with Unix Timestamp tokens (X/x) and other visual tokens in strict mode results in Invalid Date
**Describe the bug**
When X/x token is used and there are visual/escaped tokens in strict mode you get `Invalid Date`, best described with this code snippet and log result:
<details><summary>source: </summary>
... | I see.
Cause x X format is supported via advancedFormat plugin, you may enable it to use in strict mode
https://day.js.org/docs/en/plugin/advanced-format
It's enabled. look at the collapsed "source" section of the issue I have this there:
```js
const dayjs = require('dayjs');
dayjs.extend(require('dayjs/plugi... | 2021-07-07T06:40:14Z | 1.1 |
iamkun/dayjs | 1,321 | iamkun__dayjs-1321 | [
"1238"
] | 344bdc0eed6843edb05723dc7853a41833d88f08 | diff --git a/src/plugin/customParseFormat/index.js b/src/plugin/customParseFormat/index.js
--- a/src/plugin/customParseFormat/index.js
+++ b/src/plugin/customParseFormat/index.js
@@ -11,7 +11,7 @@ const matchSigned = /[+-]?\d+/ // -inf - inf
const matchOffset = /[+-]\d\d:?(\d\d)?/ // +00:00 -00:00 +0000 or -0000 +00
... | diff --git a/test/plugin/customParseFormat.test.js b/test/plugin/customParseFormat.test.js
--- a/test/plugin/customParseFormat.test.js
+++ b/test/plugin/customParseFormat.test.js
@@ -294,6 +294,8 @@ describe('Strict mode', () => {
const format = 'YYYY-MM-DD'
expect(dayjs(input, format).isValid()).toBe(true)
... | Invalid dates are parsed as valid
Invalid dates are parsed resulting in incorrect values
e.g,
const dt = dayjs('1993-51-11')
`dt.isValid()` returns `true` and `dt.format('YYYY-MM-DD')` returns `1997-03-11`
const dt = dayjs('1993-51-41')
`dt.isValid()` returns `true` and `dt.format('YYYY-MM-DD')` returns `1997-04-... | Yes, this is valid to js Date.
You can use strict parsing to get what you need. https://day.js.org/docs/en/parse/string-format
```
dayjs('1970-00-00', 'YYYY-MM-DD', true).isValid() // false
```
Does Day.js strict parsing validate time formats as well? Following returns true. Should it return false since date s... | 2021-01-07T12:23:39Z | 1.1 |
iamkun/dayjs | 1,414 | iamkun__dayjs-1414 | [
"1363"
] | b1abdc40ee6c9d18ff46c311a114e0755677ea6f | diff --git a/src/locale/es-do.js b/src/locale/es-do.js
--- a/src/locale/es-do.js
+++ b/src/locale/es-do.js
@@ -6,7 +6,7 @@ const locale = {
weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
weekdaysMin: 'do_lu_ma_mi_ju_v... | diff --git a/test/locale.test.js b/test/locale.test.js
--- a/test/locale.test.js
+++ b/test/locale.test.js
@@ -17,7 +17,7 @@ const NOT_SUPPORTED_LOCALE_STRING = 'not_supported_locale_string'
it('Uses spanish locale through constructor', () => { // not recommend
expect(dayjs('2018-4-28', { locale: es })
.format... | Spanish days and months should be lowercase
Spanish speaking people do not capitalize their months or days.
| would you like to create a pull request to update it? | 2021-03-13T19:51:51Z | 1.1 |
iamkun/dayjs | 1,229 | iamkun__dayjs-1229 | [
"1212"
] | 34cfb920b9653ad44d4b31fe49e533692a3ce01b | diff --git a/src/plugin/timezone/index.js b/src/plugin/timezone/index.js
--- a/src/plugin/timezone/index.js
+++ b/src/plugin/timezone/index.js
@@ -114,6 +114,17 @@ export default (o, c, d) => {
return result && result.value
}
+ const oldStartOf = proto.startOf
+ proto.startOf = function (units, startOf) {
+... | diff --git a/test/plugin/timezone.test.js b/test/plugin/timezone.test.js
--- a/test/plugin/timezone.test.js
+++ b/test/plugin/timezone.test.js
@@ -290,3 +290,17 @@ describe('CustomPraseFormat', () => {
expect(dayjs.tz('10/15/2020 12:30', 'MM/DD/YYYY HH:mm', DEN).unix()).toBe(result)
})
})
+
+describe('startOf ... | Getting wrong startOf('day') in a different timezone
**Describe the bug**
On calculating startOf('day') in a different timezone, I am getting the wrong result. Note that I tried this at 6 PM on November 12 in Asia/Kolkata timezone.
Code - `dayjs.tz(new Date()).tz('America/New_York').startOf('day').toString()`
Result... | I have a reproduction for this in the dayjs test suite, but I'm not sure how to fix it. Here is how I reproduced it in `test/timezone.test.js`:
```js
it('startOf day across timezones', () => {
const originalDay = dayjs('2010-01-01T00:00:00Z').tz('UTC')
const startOfDay = originalDay.startOf('day')
expect(... | 2020-11-16T19:32:50Z | 1.9 |
iamkun/dayjs | 1,086 | iamkun__dayjs-1086 | [
"1079"
] | a78956e8664afa61bb2744c7a1bbe01d2589a4fe | diff --git a/src/index.js b/src/index.js
--- a/src/index.js
+++ b/src/index.js
@@ -1,6 +1,6 @@
import * as C from './constant'
-import U from './utils'
import en from './locale/en'
+import U from './utils'
let L = 'en' // global locale
const Ls = {} // global loaded locale
@@ -43,6 +43,7 @@ const wrapper = (date,... | diff --git a/test/plugin/advancedFormat.test.js b/test/plugin/advancedFormat.test.js
--- a/test/plugin/advancedFormat.test.js
+++ b/test/plugin/advancedFormat.test.js
@@ -4,8 +4,12 @@ import dayjs from '../../src'
import advancedFormat from '../../src/plugin/advancedFormat'
import weekOfYear from '../../src/plugin/we... | `dayjs.tz()` needs to have timezone parameter as optional
**Describe the bug**
Because you can set a default timezone, the `dayjs.tz()` method should have the second parameter (timezone) as optional. It works fine in JS — just missing the correct types for TS.
**Expected behavior**
1. Set `dayjs.tz.setDefault("Am... | 2020-09-28T02:27:17Z | 1.8 | |
iamkun/dayjs | 1,101 | iamkun__dayjs-1101 | [
"1105"
] | 16937d16e053b8c1d4a607622fa2fdbfd9809832 | diff --git a/src/plugin/localeData/index.js b/src/plugin/localeData/index.js
--- a/src/plugin/localeData/index.js
+++ b/src/plugin/localeData/index.js
@@ -1,3 +1,5 @@
+import { t } from '../localizedFormat'
+
export default (o, c, dayjs) => { // locale needed later
const proto = c.prototype
const getLocalePart =... | diff --git a/test/plugin/localeData.test.js b/test/plugin/localeData.test.js
--- a/test/plugin/localeData.test.js
+++ b/test/plugin/localeData.test.js
@@ -38,7 +38,7 @@ describe('Instance localeData', () => {
expect(dayjsLocaleData.weekdaysMin()).toEqual(momentLocaleData.weekdaysMin())
expect(dayjsLocaleD... | wrong day in my timezone (UTC+3)
**Describe the bug**
I noticed a utc test failing after midnight at my timezone.
**Expected behavior**
Run tests.
**Information**
- Day.js dev branch
- OS: macos
- Node v14.11.0
- Time zone:(UTC+3)
 => {
const localUtcOffset = d().utcOffset()
const tzOffset = (timestamp,... | diff --git a/test/plugin/timezone.test.js b/test/plugin/timezone.test.js
--- a/test/plugin/timezone.test.js
+++ b/test/plugin/timezone.test.js
@@ -56,6 +56,14 @@ describe('Parse', () => {
expect(newYork.tz('America/Los_Angeles').format()).toBe('2014-06-01T09:00:00-07:00')
expect(newYork.tz('Europe/London').fo... | Changing timezone sets milliseconds to 0
**Describe the bug**
```js
let d = dayjs(1596735327399);
console.log(d.millisecond()); // Will print 399
d = d.tz('America/New_York');
console.log(d.millisecond()); // Will print 0
```
**Expected behavior**
Milliseconds should be preserved.
**Information**
- Day.j... | Thanks, Fixed. | 2020-08-13T18:14:40Z | 1.8 |
iamkun/dayjs | 1,023 | iamkun__dayjs-1023 | [
"1022"
] | a09d259a407b81d1cb6bb5623fad551c775d8674 | diff --git a/src/utils.js b/src/utils.js
--- a/src/utils.js
+++ b/src/utils.js
@@ -18,9 +18,9 @@ const monthDiff = (a, b) => {
// function from moment.js in order to keep the same result
if (a.date() < b.date()) return -monthDiff(b, a)
const wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month(... | diff --git a/test/plugin/badMutable.test.js b/test/plugin/badMutable.test.js
--- a/test/plugin/badMutable.test.js
+++ b/test/plugin/badMutable.test.js
@@ -164,6 +164,16 @@ it('Locale', () => {
expect(d.format(format)).toBe(m.format(format))
})
+it('Diff', () => {
+ const d = dayjs()
+ const m = moment()
+ cons... | RelativeTime plugin bug while using BadMutable plugin
**Describe the bug**
When I use RelativeTime plugin with BadMutable plugin in my react project, I get wrong answer.
For Example: The time variable gets `in infinity years` instead of `4 months ago`.
```javascript
import React from 'react';
import dayjs from '... | 2020-08-22T09:10:02Z | 1.8 | |
iamkun/dayjs | 996 | iamkun__dayjs-996 | [
"692"
] | 747c0fb4eba6353755b5dad3417fd8d5a408c378 | diff --git a/src/plugin/pluralGetSet/index.js b/src/plugin/pluralGetSet/index.js
new file mode 100644
--- /dev/null
+++ b/src/plugin/pluralGetSet/index.js
@@ -0,0 +1,21 @@
+export default (o, c) => {
+ const proto = c.prototype
+
+ const pluralAliases = [
+ 'milliseconds',
+ 'seconds',
+ 'minutes',
+ 'hou... | diff --git a/test/plugin/pluralGetSet.test.js b/test/plugin/pluralGetSet.test.js
new file mode 100644
--- /dev/null
+++ b/test/plugin/pluralGetSet.test.js
@@ -0,0 +1,125 @@
+import MockDate from 'mockdate'
+import moment from 'moment'
+import dayjs from '../../src'
+import pluralGetSet from '../../src/plugin/pluralGetS... | Getter/setter plural aliases missing (e.g. hour() works but hours() does not)
https://github.com/iamkun/dayjs/issues/58#issuecomment-540910296
| It's easy to add this as a plugin, but is it necessary?
@iamkun I definitely think so. You have plural support in `diff`, e.g. https://github.com/iamkun/dayjs/blob/4c862f682e763c5ad27ebc2492f7a40d0030ea4f/test/display.test.js#L180.
yes, that plural for unit
I think that if you have plural and singular in some parts o... | 2020-08-08T16:51:18Z | 1.8 |
iamkun/dayjs | 980 | iamkun__dayjs-980 | [
"979"
] | 90c98e44a74512d092585c9fa49c7f6710aa8b29 | diff --git a/src/constant.js b/src/constant.js
--- a/src/constant.js
+++ b/src/constant.js
@@ -26,5 +26,5 @@ export const FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ssZ'
export const INVALID_DATE_STRING = 'Invalid Date'
// regex
-export const REGEX_PARSE = /^(\d{4})-?(\d{1,2})?-?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{... | diff --git a/test/parse.test.js b/test/parse.test.js
--- a/test/parse.test.js
+++ b/test/parse.test.js
@@ -1,6 +1,7 @@
import moment from 'moment'
import MockDate from 'mockdate'
import dayjs from '../src'
+import { REGEX_PARSE } from '../src/constant'
beforeEach(() => {
MockDate.set(new Date())
@@ -125,3 +126... | parseDate error from recent release.
**Describe the bug**
from https://github.com/iamkun/dayjs/pull/969
```
// v1.8.30
export var REGEX_PARSE = /^(\d{4})-?(\d{1,2})-?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?.?(\d{1,3})?$/;
// v1.8.31
export var REGEX_PARSE = /^(\d{4})-?(\d{1,2})?-?(\d{0,2})[^0-9]*(\d... | Thanks, fixed in https://github.com/iamkun/dayjs/pull/980#issuecomment-667884647 | 2020-08-03T08:24:39Z | 1.8 |
iamkun/dayjs | 851 | iamkun__dayjs-851 | [
"830"
] | 29a7e74e97232bf2de2cf3399d5787d789ab211a | diff --git a/src/plugin/relativeTime/index.js b/src/plugin/relativeTime/index.js
--- a/src/plugin/relativeTime/index.js
+++ b/src/plugin/relativeTime/index.js
@@ -1,6 +1,7 @@
import * as C from '../../constant'
export default (o, c, d) => {
+ o = o || {}
const proto = c.prototype
d.en.relativeTime = {
f... | diff --git a/test/plugin/relativeTime.test.js b/test/plugin/relativeTime.test.js
--- a/test/plugin/relativeTime.test.js
+++ b/test/plugin/relativeTime.test.js
@@ -1,6 +1,7 @@
import MockDate from 'mockdate'
import moment from 'moment'
import dayjs from '../../src'
+import * as C from '../../src/constant'
import rel... | How to get precise second(s) in `relativeTime` plugin?
**Describe the bug**
https://github.com/iamkun/dayjs/blob/dev/src/plugin/relativeTime/index.js#L8
All `seconds` displays `a few seconds`
**Expected behavior**
I want to display `1 second, 2 seconds...`
**Information**
- Day.js Version: 1.8.22
| You can customize these string using:
https://day.js.org/docs/en/display/from-now#list-of-breakdown-range
But why they're different with other units by default?
And I tried
```js
dayjs.updateLocale('en', {
relativeTime: {
...dayjs.Ls.en.relativeTime,
s: 'a second',
ss: '%d seconds',
},
}... | 2020-03-26T16:05:26Z | 1.8 |
iamkun/dayjs | 1,112 | iamkun__dayjs-1112 | [
"1111"
] | 7937ccdeac47d094a60e65ebb62a6020b81c46f4 | diff --git a/src/locale/hu.js b/src/locale/hu.js
--- a/src/locale/hu.js
+++ b/src/locale/hu.js
@@ -13,17 +13,17 @@ const locale = {
relativeTime: {
future: '%s múlva',
past: '%s',
- s: 'néhány másodperc',
- m: 'egy perc',
- mm: '%d perc',
- h: 'egy óra',
- hh: '%d óra',
- d: 'egy nap',
- ... | diff --git a/test/locale/hu.test.js b/test/locale/hu.test.js
new file mode 100644
--- /dev/null
+++ b/test/locale/hu.test.js
@@ -0,0 +1,45 @@
+import moment from 'moment'
+import dayjs from '../../src'
+import relativeTime from '../../src/plugin/relativeTime'
+import '../../src/locale/hu'
+
+dayjs.extend(relativeTime)
... | Improve hungarian localization
Hi!
I would like to improve the hungarian localization! Currently the package does not handle the past relative times at all. The main problem is that in hungarian we don't have a single word to show that a date is in the past, like `ago` in english. Instead we add letters to each word... | Maybe this is what you are looking for https://day.js.org/docs/en/customization/relative-time#additional-token-processing
Exactly, thanks, will customize my localization locally and once it's looking good I will create a PR to provide a fix for everybody. | 2020-10-04T18:13:22Z | 1.9 |
iamkun/dayjs | 891 | iamkun__dayjs-891 | [
"888"
] | bcea06730da2d19ddbad844de3557ee077af821c | diff --git a/src/index.js b/src/index.js
--- a/src/index.js
+++ b/src/index.js
@@ -28,13 +28,14 @@ const parseLocale = (preset, object, isLocal) => {
return l || (!isLocal && L)
}
-const dayjs = (date, c, pl) => {
+const dayjs = function (date, c) {
if (isDayjs(date)) {
return date.clone()
}
// esli... | diff --git a/test/plugin/badMutable.test.js b/test/plugin/badMutable.test.js
--- a/test/plugin/badMutable.test.js
+++ b/test/plugin/badMutable.test.js
@@ -2,9 +2,11 @@ import MockDate from 'mockdate'
import moment from 'moment'
import dayjs from '../../src'
import badMutable from '../../src/plugin/badMutable'
+impor... | Duration.toISOString() returns wrong result
**Describe the bug**
dayjs.duration(dayjs.duration(1, 'minutes').toISOString()).as('minutes') returns 43200
dayjs.duration(1, 'minutes').toISOString() return 'P1M'
**Expected behavior**
Should return 1
Suppose that dayjs.duration(1, 'minutes').toISOString() should retu... | 2020-04-30T04:04:45Z | 1.8 | |
iamkun/dayjs | 768 | iamkun__dayjs-768 | [
"761"
] | 6b587dabc13b06a73c6bec9b77ec8aca890ebf0a | diff --git a/src/locale/cs.js b/src/locale/cs.js
--- a/src/locale/cs.js
+++ b/src/locale/cs.js
@@ -1,5 +1,52 @@
import dayjs from 'dayjs'
+function plural(n) {
+ return (n > 1) && (n < 5) && (~~(n / 10) !== 1) // eslint-disable-line
+}
+/* eslint-disable */
+function translate(number, withoutSuffix, key, isFuture)... | diff --git a/test/locale/cs.test.js b/test/locale/cs.test.js
new file mode 100644
--- /dev/null
+++ b/test/locale/cs.test.js
@@ -0,0 +1,52 @@
+import moment from 'moment'
+import MockDate from 'mockdate'
+import dayjs from '../../src'
+import relativeTime from '../../src/plugin/relativeTime'
+import '../../src/locale/c... | the result of dayjs("2019-02", "YYYY-MM") is wrong
**Describe the bug**
```
import dayjs from "dayjs";
import customParseFormat from "dayjs/plugin/customParseFormat";
dayjs.extend(customParseFormat);
2019-02 dayjs format: {dayjs("2019-02", "YYYY-MM").format("YYYY-MM")}
```
result: `2019-03`
expected: `2019-02... | 2020-01-06T09:04:03Z | 1.8 | |
iamkun/dayjs | 719 | iamkun__dayjs-719 | [
"676"
] | 7241da91aab31613e316dce72cd723c162d2b54e | diff --git a/src/index.js b/src/index.js
--- a/src/index.js
+++ b/src/index.js
@@ -38,7 +38,12 @@ const dayjs = (date, c, pl) => {
return new Dayjs(cfg) // eslint-disable-line no-use-before-define
}
-const wrapper = (date, instance) => dayjs(date, { locale: instance.$L, utc: instance.$u })
+const wrapper = (date,... | diff --git a/test/plugin/utc-utcOffset.test.js b/test/plugin/utc-utcOffset.test.js
new file mode 100644
--- /dev/null
+++ b/test/plugin/utc-utcOffset.test.js
@@ -0,0 +1,103 @@
+import MockDate from 'mockdate'
+import moment from 'moment'
+import dayjs from '../../src'
+import utc from '../../src/plugin/utc'
+
+dayjs.ex... | dayjs().format('YYYY w Week') error result
**Describe the bug**
使用dayjs().format('YYYY年第w周') 期望可以得到 2019年第29周
**Expected behavior**
使用dayjs().format('YYYY年第w周') 期望可以得到 2019年第29周,实际上却展示为2019年第w周
**Information**
- Day.js 版本1.8.16
- OS: Linux
- Browser chrome 74.0.3729.131
- Time zone: GMT+08:00
| 2019-11-06T04:55:21Z | 1.8 | |
iamkun/dayjs | 678 | iamkun__dayjs-678 | [
"676"
] | 88778838e71dd309e79cd1a8094d5bea36ca3390 | diff --git a/src/plugin/advancedFormat/index.js b/src/plugin/advancedFormat/index.js
--- a/src/plugin/advancedFormat/index.js
+++ b/src/plugin/advancedFormat/index.js
@@ -13,7 +13,7 @@ export default (o, c, d) => { // locale needed later
const locale = this.$locale()
const utils = this.$utils()
const str... | diff --git a/test/plugin/weekOfYear.test.js b/test/plugin/weekOfYear.test.js
--- a/test/plugin/weekOfYear.test.js
+++ b/test/plugin/weekOfYear.test.js
@@ -2,8 +2,10 @@ import moment from 'moment'
import MockDate from 'mockdate'
import dayjs from '../../src'
import weekOfYear from '../../src/plugin/weekOfYear'
+impor... | dayjs().format('YYYY w Week') error result
**Describe the bug**
使用dayjs().format('YYYY年第w周') 期望可以得到 2019年第29周
**Expected behavior**
使用dayjs().format('YYYY年第w周') 期望可以得到 2019年第29周,实际上却展示为2019年第w周
**Information**
- Day.js 版本1.8.16
- OS: Linux
- Browser chrome 74.0.3729.131
- Time zone: GMT+08:00
| Bug confirmed.
Current workaround
```
var dayjs = require("dayjs")
var advancedFormat = require('dayjs/plugin/advancedFormat')
var weekOfYear = require('dayjs/plugin/weekOfYear')
dayjs.extend(advancedFormat)
dayjs.extend(weekOfYear)
dayjs().format('YYYY年第wo周')
``` | 2019-09-17T14:05:47Z | 1.8 |
iamkun/dayjs | 539 | iamkun__dayjs-539 | [
"531"
] | 6e29a4aa793d48cc57635da6a19ef227fbe3e3b5 | diff --git a/src/locale/az.js b/src/locale/az.js
new file mode 100644
--- /dev/null
+++ b/src/locale/az.js
@@ -0,0 +1,39 @@
+import dayjs from 'dayjs'
+
+const locale = {
+ name: 'az',
+ weekdays: 'Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split('_'),
+ weekdaysShort: 'Baz_BzE_ÇAx_Çər_CAx_C... | diff --git a/test/plugin/customParseFormat.test.js b/test/plugin/customParseFormat.test.js
--- a/test/plugin/customParseFormat.test.js
+++ b/test/plugin/customParseFormat.test.js
@@ -26,6 +26,12 @@ it('parse padded string', () => {
expect(dayjs(input, format).valueOf()).toBe(moment(input, format).valueOf())
})
+i... | Typescript definition allows `quarter` as unit of time
**Describe the bug**
According to the typescript definition, this is valid:
```ts
val now = dayjs()
val nextQuarter = now.add(1, 'quarter')
now.valueOf() == nextQuarter.valueOf() // true
```
**Expected behavior**
Either the quarter calculation shoul... | Thanks, will fix soon | 2019-03-21T04:40:34Z | 1.8 |
iamkun/dayjs | 528 | iamkun__dayjs-528 | [
"522"
] | 8ddbe923eee5f996a089e55619686c92d69a85c2 | diff --git a/src/index.js b/src/index.js
--- a/src/index.js
+++ b/src/index.js
@@ -109,36 +109,41 @@ class Dayjs {
return this.endOf(units) < dayjs(that)
}
- year() {
- return this.$y
+ $g(input, get, set) {
+ if (Utils.u(input)) return this[get]
+ return this.set(set, input)
}
- month() {
- ... | diff --git a/test/display.test.js b/test/display.test.js
--- a/test/display.test.js
+++ b/test/display.test.js
@@ -230,10 +230,6 @@ it('As Javascript Date -> toDate', () => {
expect(jsDate.toUTCString()).not.toBe(base.toString())
})
-it('As Array -> toArray', () => {
- expect(dayjs().toArray()).toEqual(moment().... | CustomParseFormat doesn't parse ordinals correctly when AdvancedFormat is enabled
**Describe the bug**
When using `AdvancedFormat` plugin that allows ordinals, the `CustomParseFormat` plugin doesn't parse dates that have ordinals. So:
```javascript
dayjs('7th March 2019', 'Do MMMM YYYY')
```
returns
```jav... | 2019-03-10T12:47:27Z | 1.8 | |
iamkun/dayjs | 453 | iamkun__dayjs-453 | [
"384"
] | 3bd06f2a028da36275d65b1aa6fdf340dbd779b3 | diff --git a/src/constant.js b/src/constant.js
--- a/src/constant.js
+++ b/src/constant.js
@@ -34,4 +34,3 @@ export const en = {
weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_... | diff --git a/test/display.test.js b/test/display.test.js
--- a/test/display.test.js
+++ b/test/display.test.js
@@ -86,7 +86,6 @@ it('Format Second s ss SSS', () => {
expect(dayjs(date).format('s-ss-SSS')).toBe(moment(date).format('s-ss-SSS'))
})
-
it('Format Time Zone ZZ', () => {
MockDate.set(new Date('2018-... | diff() in "days" broken after making add() "days" aware of daylight-saving changes
Computing difference between two dates, which one was subtracted 1000 days from, returns 999 days, if the date is on the boundary of daylight-saving changes:
```
> d1 = dayjs('2018-10-28')
2018-10-27T22:00:00.000Z
> d2 = dayjs('201... | Related: Adding one `'day'` on a daylight-changing day is broken. It adds 24 hours, no matter if that day has 23, 24 or 25 hours.
```
let a = dayjs('2018-11-04');
console.log(a);
// h {$d: Sun Nov 04 2018 00:00:00 GMT-0400 (Eastern Daylight Time), $y: 2018, $M: 10, $D: 4, ...}
a = a.add(1, 'day');
console.log(a);... | 2019-01-16T08:45:52Z | 1.8 |
iamkun/dayjs | 76 | iamkun__dayjs-76 | [
"70"
] | 33151dac2b86b1a620e91573e42c2e8df6cf3d67 | diff --git a/src/index.js b/src/index.js
--- a/src/index.js
+++ b/src/index.js
@@ -3,6 +3,7 @@ import * as Utils from './utils'
const parseConfig = (config) => {
let reg
+ if (config === null) return new Date(NaN) // Treat null as an invalid date
if (!config) return new Date()
if (config instanceof Date) r... | diff --git a/test/parse.test.js b/test/parse.test.js
--- a/test/parse.test.js
+++ b/test/parse.test.js
@@ -27,11 +27,12 @@ describe('Parse', () => {
expect(dayjs(time).valueOf()).toBe(moment(time).valueOf())
})
- it('String Other and isValid', () => {
+ it('String Other, Null and isValid', () => {
glob... | Format need to check date is invalid & Don't format dayjs(null)
```js
const dayjs = require('dayjs');
const moment = require('moment');
console.log('\n=== dayjs ===');
console.log(dayjs('wtf').format());
console.log(dayjs(null).format());
console.log('\n=== moment ===');
console.log(moment('wtf').format());
... | After checking ECMAScript docs, I found a interesting thing.
```
new Date(null) // Valid
new Date(0) // Valid
// but:
new Date(undefined) // Invalid
new Date('wtf') // Invalid
```
That is to say, null is considered as a valid date in JS.
Still, I think `null` is different to `0`, and `null` should be an __in... | 2018-04-28T02:43:20Z | 1.5 |
iamkun/dayjs | 55 | iamkun__dayjs-55 | [
"49"
] | b3a678d9e180ddcf4acf48fa8846468052f00229 | diff --git a/src/index.js b/src/index.js
--- a/src/index.js
+++ b/src/index.js
@@ -2,16 +2,15 @@ import * as C from './constant'
import * as Utils from './utils'
const parseConfig = (config) => {
+ let reg
if (!config) return new Date()
if (config instanceof Date) return config
- const configStr = String(co... | diff --git a/test/manipulate.test.js b/test/manipulate.test.js
--- a/test/manipulate.test.js
+++ b/test/manipulate.test.js
@@ -10,25 +10,21 @@ afterEach(() => {
MockDate.reset()
})
-it('StartOf EndOf Year with s and upper case', () => {
- expect(dayjs().startOf('YearS').unix()).toBe(moment().startOf('year').unix... | startOf 不支持week 选项
dayjs().startOf('week').format('YYYY-MM-DD')
dayjs().endOf('week').format('YYYY-MM-DD')
| 自己写下吧!我也在用这个功能
嗯,我在写。。。。
我就不fork了,直接上代码:
```javascript
//本周
let t = dayjs()
let val1 = t.set('date', t.$D - t.$W).add(1, 'd').format('YYYY-MM-DD') //本周第一天(周一)
let val2 = t.set('date', t.$D + (6 - t.$W)).add(1, 'd').format('YYYY-MM-DD') //本周最后一天(周日)
//上周
let t = dayjs().subtract(1, 'w')
let val1 = t.set('d... | 2018-04-25T15:40:50Z | 1.5 |
iamkun/dayjs | 337 | iamkun__dayjs-337 | [
"244"
] | 36c4e94f014a78c186b354f003c048fdb5562464 | diff --git a/src/index.js b/src/index.js
--- a/src/index.js
+++ b/src/index.js
@@ -384,6 +384,8 @@ class Dayjs {
}
}
+dayjs.prototype = Dayjs.prototype
+
dayjs.extend = (plugin, option) => {
plugin(option, Dayjs, dayjs)
return dayjs
| diff --git a/test/constructor.test.js b/test/constructor.test.js
new file mode 100644
--- /dev/null
+++ b/test/constructor.test.js
@@ -0,0 +1,18 @@
+import MockDate from 'mockdate'
+import dayjs from '../src'
+
+beforeEach(() => {
+ MockDate.set(new Date())
+})
+
+afterEach(() => {
+ MockDate.reset()
+})
+
+it('suppo... | dayjs() instanceof dayjs = false
Hi,
I tried to replace moment with dayjs,but some old code have this condition:
```
if (aMomentDate instanceof moment) {
//do something
}
```
if this meet dayjs, it would be false and the `if` can not be enter.
after I found the problem , I tried this:
```
moment() instanceo... | @wslx520 Thanks.
Just added `dayjs.isDayjs` API to deal with this in release 1.6.9. So that you could do:
```javascript
if (dayjs.isDayjs( aDayjsObject)) {
// then
}
```
But I have no idea about how to make `dayjs() instanceof dayjs` to be true. Any one could help?
jQuery also: $() instanceOf $ // true
some... | 2018-09-13T05:31:28Z | 1.7 |
iamkun/dayjs | 1,161 | iamkun__dayjs-1161 | [
"1149"
] | 9a407a140b089345a387d1aceab4d0d1635229c7 | diff --git a/src/plugin/timezone/index.js b/src/plugin/timezone/index.js
--- a/src/plugin/timezone/index.js
+++ b/src/plugin/timezone/index.js
@@ -1,3 +1,5 @@
+import { MIN, MS } from '../../constant'
+
const typeToPos = {
year: 0,
month: 1,
@@ -7,8 +9,6 @@ const typeToPos = {
second: 5
}
-const ms = 'ms'
... | diff --git a/test/plugin/timezone.test.js b/test/plugin/timezone.test.js
--- a/test/plugin/timezone.test.js
+++ b/test/plugin/timezone.test.js
@@ -1,8 +1,8 @@
import MockDate from 'mockdate'
import moment from 'moment-timezone'
import dayjs from '../../src'
-import utc from '../../src/plugin/utc'
import timezone fr... | Only changing the timezone (similar to moment.tz(keeptime=true))
Here is a code sample from Moment's timezone. I would like to achieve the `true` flag so only the offset changes when time stays the same.
```
var m = moment.tz("2013-11-18 11:55", "America/Toronto");
m.format(); // 2013-11-18... | @iamkun bumping this issue. Is this feature already available? | 2020-10-21T08:06:37Z | 1.9 |
iamkun/dayjs | 952 | iamkun__dayjs-952 | [
"944"
] | bc071568f12cdb3fc00f7f20552b86c80c853d3a | diff --git a/src/plugin/duration/index.js b/src/plugin/duration/index.js
--- a/src/plugin/duration/index.js
+++ b/src/plugin/duration/index.js
@@ -48,7 +48,7 @@ class Duration {
const d = input.match(durationRegex)
if (d) {
[,,
- this.$d.years, this.$d.months,,
+ this.$d.years, ... | diff --git a/test/plugin/duration.test.js b/test/plugin/duration.test.js
--- a/test/plugin/duration.test.js
+++ b/test/plugin/duration.test.js
@@ -62,6 +62,12 @@ describe('Parse ISO string', () => {
it('Part ISO string', () => {
expect(dayjs.duration('PT2777H46M40S').toISOString()).toBe('PT2777H46M40S')
})
+... | Array format support is not reflected in the type definition for typescript
**Describe the bug**
Array format is supported by #906, but typescript gives the following type error.
```typescript
dayjs('2020-02-02', ['YYYY', 'YYYY-DD-MM'])
```
```
error TS2345: Argument of type 'string[]' is not assignable to p... | 2020-07-02T10:30:23Z | 1.8 | |
iamkun/dayjs | 162 | iamkun__dayjs-162 | [
"138"
] | cdacf2dca8a2420f87bf45ed2986f36b0199da4f | diff --git a/index.d.ts b/index.d.ts
--- a/index.d.ts
+++ b/index.d.ts
@@ -87,7 +87,7 @@ declare namespace dayjs {
export type PluginFunc = (option: ConfigType, d1: Dayjs, d2: Dayjs) => void
- export function extend(plugin: PluginFunc, option: ConfigType): Dayjs
+ export function extend(plugin: PluginFunc, opt... | diff --git a/test/manipulate.test.js b/test/manipulate.test.js
--- a/test/manipulate.test.js
+++ b/test/manipulate.test.js
@@ -43,6 +43,8 @@ it('Add Time days', () => {
expect(dayjs().add(1, 'M').valueOf()).toBe(moment().add(1, 'M').valueOf())
expect(dayjs().add(1, 'y').valueOf()).toBe(moment().add(1, 'y').valueO... | dayjs init data seems not right
When I init data like this, not like `moment.js` can make right way to parse the Date String.
```
console.log(dayjs('2018-01'))
output:
Fri Dec 01 2017 00:00:00 GMT+0800 (CST
```
But I can solve by pass the Date, and init with `new Date(string)`.
```
console.log(dayjs(new... | It's a bug. However, maybe dayjs('2018-01-01') would be better?
'2018-01' could either be '2018-01-01' or '2018-01-31'
| 2018-05-18T07:55:52Z | 1.6 |
python-pillow/Pillow | 8,852 | python-pillow__Pillow-8852 | [
"8828"
] | 869aa5843c79c092db074b17234e792682eada41 | diff --git a/src/PIL/Image.py b/src/PIL/Image.py
--- a/src/PIL/Image.py
+++ b/src/PIL/Image.py
@@ -2540,8 +2540,13 @@ def save(
msg = f"unknown file extension: {ext}"
raise ValueError(msg) from e
+ from . import ImageFile
+
# may mutate self!
- self._ensure_mut... | diff --git a/Tests/test_image.py b/Tests/test_image.py
--- a/Tests/test_image.py
+++ b/Tests/test_image.py
@@ -258,6 +258,15 @@ def test_readonly_save(self, tmp_path: Path) -> None:
assert im.readonly
im.save(temp_file)
+ def test_save_without_changing_readonly(self, tmp_path: Path) -> No... | Image.save() causes images created by Image.frombuffer() to stop reflecting changes in that buffer
Hi, recently messed with PIL to encounter what is probably a bug
### What did you do?
```python
import numpy as np
from PIL import Image
# Source of data for image
im_data: np.typing.NDArray = np.array([[255]], dtype... | To explain slightly, you can see in `frombuffer()` that `readonly` is set to 1.
https://github.com/python-pillow/Pillow/blob/af09976a5f57e8aebaedf332bc4025ea1b068af4/src/PIL/Image.py#L3186
And when `_ensure_mutable` sees this,
https://github.com/python-pillow/Pillow/blob/af09976a5f57e8aebaedf332bc4025ea1b068af4/src/... | 2025-04-01T07:41:26Z | 11.1 |
python-pillow/Pillow | 8,792 | python-pillow__Pillow-8792 | [
"8790"
] | 5d52ede584c5137f3a0b00be97dea8764404306b | diff --git a/src/PIL/ImageOps.py b/src/PIL/ImageOps.py
--- a/src/PIL/ImageOps.py
+++ b/src/PIL/ImageOps.py
@@ -729,11 +729,15 @@ def exif_transpose(image: Image.Image, *, in_place: bool = False) -> Image.Image
r"<tiff:Orientation>([0-9])</tiff:Orientation>",
):
... | diff --git a/Tests/test_imageops.py b/Tests/test_imageops.py
--- a/Tests/test_imageops.py
+++ b/Tests/test_imageops.py
@@ -448,6 +448,15 @@ def check(orientation_im: Image.Image) -> None:
assert 0x0112 not in transposed_im.getexif()
+def test_exif_transpose_with_xmp_tuple() -> None:
+ with Image.open("Tests... | XMP <?xpacket> wrapper tags causes exception in ImageOps.exif_transpose()
<!--
Thank you for reporting an issue.
Follow these guidelines to ensure your issue is handled properly.
If you have a ...
1. General question: consider asking the question on Stack Overflow
with the python-imaging-library tag:
* htt... | 2025-03-03T08:10:20Z | 11.1 | |
python-pillow/Pillow | 8,701 | python-pillow__Pillow-8701 | [
"8697"
] | cf7dd2f0e9ff3b0b228ad6cc5060096ab7267806 | diff --git a/src/PIL/ImageDraw.py b/src/PIL/ImageDraw.py
--- a/src/PIL/ImageDraw.py
+++ b/src/PIL/ImageDraw.py
@@ -643,6 +643,7 @@ def draw_text(ink: int, stroke_width: float = 0) -> None:
features=features,
language=language,
stroke_width=stroke_width,
+ ... | diff --git a/Tests/test_imagedraw.py b/Tests/test_imagedraw.py
--- a/Tests/test_imagedraw.py
+++ b/Tests/test_imagedraw.py
@@ -1396,6 +1396,28 @@ def test_stroke_descender() -> None:
assert_image_similar_tofile(im, "Tests/images/imagedraw_stroke_descender.png", 6.76)
+@skip_unless_feature("freetype2")
+def tes... | Stroke Text Tittles Not Working Correctly
### What did you do?
When trying to create a piece of text with a stroke fill the tittles on `i` and `j` do not look correct.
### What did you expect to happen?
I would expect that the stroke would fill all the way to the edge of the inner fill for the tittles.
### What ac... | Taking a look, the gap between the regular text and the stroked text is generated by FreeType. It's not unique to our default font - the same issue occurs with Times New Roman.ttf on my macOS machine.
I've contacted FreeType support to see if this is considered a bug. | 2025-01-18T07:36:23Z | 11.1 |
python-pillow/Pillow | 8,535 | python-pillow__Pillow-8535 | [
"8530"
] | 7fe56d62c6739a3aebcc80e2a2cf2c8700fa3726 | diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py
--- a/src/PIL/TiffImagePlugin.py
+++ b/src/PIL/TiffImagePlugin.py
@@ -1433,8 +1433,12 @@ def _setup(self) -> None:
logger.debug("- YCbCr subsampling: %s", self.tag_v2.get(YCBCRSUBSAMPLING))
# size
- xsize = self.tag_v2.get(I... | diff --git a/Tests/test_imagefile.py b/Tests/test_imagefile.py
--- a/Tests/test_imagefile.py
+++ b/Tests/test_imagefile.py
@@ -93,6 +93,19 @@ def test_ico(self) -> None:
assert p.image is not None
assert (48, 48) == p.image.size
+ @pytest.mark.filterwarnings("ignore:Corrupt EXIF data")
+ ... | Pillow 11.0.0 and Django: TiffImagePlugin raised 'Invalid dimensions' error
Seems that v11.0.0 release add a Bug parsing tiff images:
```pytb
...
File "django/core/files/images.py", line 63, in get_image_dimensions
p.feed(data)
File "PIL/ImageFile.py", line 471, in feed
im = Image.open(fp)
File "... | Could you attach a copy of the image?
no, sorry :( ...
I'm guessing that you mean you can't for copyright/privacy reasons, but you still have a copy of the image you can test with? You can still replicate the problem on your end? Otherwise, you couldn't have determined that this passed with Pillow 10.4.0.
Are you su... | 2024-11-05T09:29:52Z | 11 |
python-pillow/Pillow | 8,602 | python-pillow__Pillow-8602 | [
"8594"
] | 6e45e710524293c5c7929899355cc7ec84600b87 | diff --git a/src/PIL/BmpImagePlugin.py b/src/PIL/BmpImagePlugin.py
--- a/src/PIL/BmpImagePlugin.py
+++ b/src/PIL/BmpImagePlugin.py
@@ -48,6 +48,8 @@
32: ("RGB", "BGRX"),
}
+USE_RAW_ALPHA = False
+
def _accept(prefix: bytes) -> bool:
return prefix[:2] == b"BM"
@@ -242,7 +244,9 @@ def _bitmap(self, header... | diff --git a/Tests/test_file_bmp.py b/Tests/test_file_bmp.py
--- a/Tests/test_file_bmp.py
+++ b/Tests/test_file_bmp.py
@@ -230,3 +230,13 @@ def test_offset() -> None:
# to exclude the palette size from the pixel data offset
with Image.open("Tests/images/pal8_offset.bmp") as im:
assert_image_equal_tof... | BmpImagePlugin - Unsupported 32bpp DIBs with Alpha
### What did you do?
Attempted to read the attached 32bpp DIB with `Image.open()`
(I've plopped it in a ZIP because GitHub doesn't like me just chucking the DIB itself in here)
[sampledib.zip](https://github.com/user-attachments/files/18119317/sampledib.zip)
##... | Sorry to bother you all with such a niche problem. :sweat_smile:
For context, the attached bitmap (DIB) comes from one of the themes in Windows XP - I am trying to look into writing a general tool for converting .MSSTYLES based themes to various Linux toolkits.
I pinpointed this line of interest in `BmpImagePlug... | 2024-12-16T06:09:33Z | 11 |
python-pillow/Pillow | 8,635 | python-pillow__Pillow-8635 | [
"8634"
] | 1a79d1025ce46b6e4ddf58e540bba8abea8fc5f6 | diff --git a/src/PIL/Image.py b/src/PIL/Image.py
--- a/src/PIL/Image.py
+++ b/src/PIL/Image.py
@@ -4023,6 +4023,9 @@ def tobytes(self, offset: int = 8) -> bytes:
head = self._get_head()
ifd = TiffImagePlugin.ImageFileDirectory_v2(ifh=head)
+ for tag, ifd_dict in self._ifds.items():
+ ... | diff --git a/Tests/test_image.py b/Tests/test_image.py
--- a/Tests/test_image.py
+++ b/Tests/test_image.py
@@ -793,6 +793,10 @@ def test_empty_get_ifd(self) -> None:
ifd[36864] = b"0220"
assert exif.get_ifd(0x8769) == {36864: b"0220"}
+ reloaded_exif = Image.Exif()
+ reloaded_exif.load... | Loss of Exif IFD attributes when saving new JPEG image
<!--
Thank you for reporting an issue.
Follow these guidelines to ensure your issue is handled properly.
If you have a ...
1. General question: consider asking the question on Stack Overflow
with the python-imaging-library tag:
* https://stac... | I've created #8635 to fix this. | 2024-12-28T20:37:59Z | 11 |
python-pillow/Pillow | 8,476 | python-pillow__Pillow-8476 | [
"8472"
] | 11c654c187ffbede40c54e6344ddec49f495d4a7 | diff --git a/src/PIL/Image.py b/src/PIL/Image.py
--- a/src/PIL/Image.py
+++ b/src/PIL/Image.py
@@ -763,7 +763,7 @@ def __getstate__(self) -> list[Any]:
def __setstate__(self, state: list[Any]) -> None:
Image.__init__(self)
- info, mode, size, palette, data = state
+ info, mode, size, palet... | diff --git a/Tests/test_pickle.py b/Tests/test_pickle.py
--- a/Tests/test_pickle.py
+++ b/Tests/test_pickle.py
@@ -74,6 +74,17 @@ def test_pickle_image(
helper_pickle_file(tmp_path, protocol, test_file, test_mode)
+def test_pickle_jpeg() -> None:
+ # Arrange
+ with Image.open("Tests/images/hopper.jpg") a... | Change in behavior with JPEG Images in 11.0.0
The following code that worked in Pillow 10.4 no longer works with Pillow 11.0.
```python
import pickle
from io import BytesIO
from PIL import Image
im = Image.open("books.jpg")
p = pickle.dumps(im)
im = pickle.loads(p)
# Fails in 11.0, works in 10.4
o... | Is this a bug or feature? It looks like Pillow got more strict in verifying that `im` was a `JpegImageFile` ?
That is a good question. Serializing an image and reloading it changes how it looks.
I wasn't sure if this check for the `layers` attribute was at one point intentional for this use case or just coincidenta... | 2024-10-17T01:46:23Z | 11 |
python-pillow/Pillow | 8,422 | python-pillow__Pillow-8422 | [
"8333"
] | 7e6e08ea6aa8e05aa20425a6d9c07d4146241909 | diff --git a/src/PIL/Image.py b/src/PIL/Image.py
--- a/src/PIL/Image.py
+++ b/src/PIL/Image.py
@@ -2278,8 +2278,8 @@ def resize(
:py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`,
:py:data:`Resampling.BICUBIC` or :py:data:`Resampling.LANCZOS`.
If the image has mode "1" or... | diff --git a/Tests/test_image_resize.py b/Tests/test_image_resize.py
--- a/Tests/test_image_resize.py
+++ b/Tests/test_image_resize.py
@@ -44,9 +44,19 @@ def test_convolution_modes(self) -> None:
self.resize(hopper("1"), (15, 12), Image.Resampling.BILINEAR)
with pytest.raises(ValueError):
... | Resize not allowing filter parameter on 16 bit image
When attempting to resize a 16 bit image as shown below, a value error appears and crashes the program: "ValueError: image has wrong mode" The image type is "I;16"
The primary problem is that this worked without error in early July and hasn't been touched in a mon... | Just to provide a self-contained code example, I agree that
```python
from PIL import Image
im = Image.new("I;16", (1, 1))
new_im = im.resize((640, 480), resample=Image.Resampling.LANCZOS)
```
is hitting
https://github.com/python-pillow/Pillow/blob/56e3147403d1785141b25f1d822a93e86c1deb98/src/libImaging/Resample... | 2024-09-28T04:41:59Z | 10.4 |
python-pillow/Pillow | 8,231 | python-pillow__Pillow-8231 | [
"8226"
] | 6a9acfa5ca2b3ba462b086e4af776993bbd94a72 | diff --git a/src/PIL/PpmImagePlugin.py b/src/PIL/PpmImagePlugin.py
--- a/src/PIL/PpmImagePlugin.py
+++ b/src/PIL/PpmImagePlugin.py
@@ -333,7 +333,7 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
rawmode, head = "1;I", b"P4"
elif im.mode == "L":
rawmode, head = "L", b... | diff --git a/Tests/test_file_ppm.py b/Tests/test_file_ppm.py
--- a/Tests/test_file_ppm.py
+++ b/Tests/test_file_ppm.py
@@ -95,7 +95,9 @@ def test_16bit_pgm_write(tmp_path: Path) -> None:
with Image.open("Tests/images/16_bit_binary.pgm") as im:
filename = str(tmp_path / "temp.pgm")
im.save(filenam... | Save 16-bit PGM Image?
I am attempting to convert an image in PNG format to a 16-bit PGM format and save it using Python's [PIL](https://python-pillow.org/) library. I'm using Python 3.12.4 in all examples shown.
---
Using the following `test.png` image:
[:768]
+ im_palette = i... | diff --git a/Tests/test_file_gif.py b/Tests/test_file_gif.py
--- a/Tests/test_file_gif.py
+++ b/Tests/test_file_gif.py
@@ -1429,3 +1429,21 @@ def test_saving_rgba(tmp_path: Path) -> None:
with Image.open(out) as reloaded:
reloaded_rgba = reloaded.convert("RGBA")
assert reloaded_rgba.load()[0, 0][... | GIF optimizer acts wrongly with black pixels when `disposal=2`
### What did you do?
- Create a GIF with these two identically sized (250x217) frames: `green.png` and `red.png`

:
try:
mpheader = im._getmp()
if mpheader[45057] > 1:
+ for segment, content in im.applist... | diff --git a/Tests/images/ultrahdr.jpg b/Tests/images/ultrahdr.jpg
new file mode 100644
Binary files /dev/null and b/Tests/images/ultrahdr.jpg differ
diff --git a/Tests/test_file_mpo.py b/Tests/test_file_mpo.py
--- a/Tests/test_file_mpo.py
+++ b/Tests/test_file_mpo.py
@@ -226,6 +226,11 @@ def test_eoferror() -> None:
... | Is this MPO file decoded correctly?
### What did you do?
```python3
from PIL import Image
im = Image.open("328384445-d4972d5b-3409-4d5f-a107-ccb8c5dc0177.jpg") # MPO file
im.show()
```
### What did you expect to happen?
Correctly decode second image
<img width="766" alt="image" src="https://github.... | Sorry my bad, I tested it on Pillow 10.2
on Pillow 10.3 there is no error when decoding, just second image looks wrong.
Updated issue to reflect this. Sorry for mess.
Hi, @bigcat88 , 10.3.0 correctly extract the second frame with a different resolution. However, the second frame is not actually a frame, it's a `g... | 2024-05-13T11:52:16Z | 10.3 |
python-pillow/Pillow | 8,063 | python-pillow__Pillow-8063 | [
"7993"
] | d879f397112d1cb50af7d27f16eaf2c7bb221043 | diff --git a/src/PIL/Image.py b/src/PIL/Image.py
--- a/src/PIL/Image.py
+++ b/src/PIL/Image.py
@@ -76,6 +76,8 @@ class DecompressionBombError(Exception):
pass
+WARN_POSSIBLE_FORMATS: bool = False
+
# Limit to around a quarter gigabyte for a 24-bit (3 bpp) image
MAX_IMAGE_PIXELS: int | None = int(1024 * 1024 ... | diff --git a/Tests/test_image.py b/Tests/test_image.py
--- a/Tests/test_image.py
+++ b/Tests/test_image.py
@@ -116,6 +116,15 @@ def test_open_formats(self) -> None:
assert im.mode == "RGB"
assert im.size == (128, 128)
+ def test_open_verbose_failure(self, monkeypatch: pytest.Monke... | cannot identify image file (PNG file from scanner)
<!--
Thank you for reporting an issue.
Follow these guidelines to ensure your issue is handled properly.
If you have a ...
1. General question: consider asking the question on Stack Overflow
with the python-imaging-library tag:
* https://stackove... | If I run [pngcheck](http://www.libpng.org/pub/png/apps/pngcheck.html) over your image, I get
> CRC error in chunk pHYs (computed eee74573, expected c76fa864)
To skip the check in Pillow, use
```python
from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
image_path = "bug.png"
image = Imag... | 2024-05-16T07:51:54Z | 10.3 |
python-pillow/Pillow | 7,948 | python-pillow__Pillow-7948 | [
"7940"
] | f8ec9f7974361c835405daf8a7c5acdf1ff98a8c | diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py
--- a/src/PIL/TiffImagePlugin.py
+++ b/src/PIL/TiffImagePlugin.py
@@ -1653,6 +1653,16 @@ def _save(im, fp, filename):
except Exception:
pass # might not be an IFD. Might not have populated type
+ legacy_ifd = {}
+ if has... | diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py
--- a/Tests/test_file_tiff.py
+++ b/Tests/test_file_tiff.py
@@ -621,6 +621,19 @@ def test_roundtrip_tiff_uint16(self, tmp_path: Path) -> None:
assert_image_equal_tofile(im, tmpfile)
+ def test_iptc(self, tmp_path: Path) -> None:
+ ... | Saving tiff triggers segfault
### What did you do?
I used the following simple script:
```python
from PIL import Image
img = Image.open("Image00386.tiff")
img.save("toto2.tiff", compression="tiff_deflate")
```
on the file contained in this zip:
https://eroux.fr/Image00386.zip
(too big to upload on ... | The problem is tag 33723. It is specified as LONG in the image, when it should be BYTE or UNDEFINED according to https://www.awaresystems.be/imaging/tiff/tifftags/iptc.html
If I adjust Pillow to not preserve LONG tag 33723 by default, then it starts raising a `RuntimeError` instead.
Is it just the segfault you ar... | 2024-04-06T08:30:14Z | 10.3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.