Skip to content

Commit

Permalink
выделил константу MAX_YEAR_BY_1C 3999
Browse files Browse the repository at this point in the history
  • Loading branch information
artbear committed Dec 18, 2023
1 parent f9d0f3f commit eccb841
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class MagicDateDiagnostic extends AbstractVisitorDiagnostic {
private static final Pattern nonNumberPattern = CaseInsensitivePattern.compile(
"\\D"
);
public static final int MAX_YEAR_BY_1C = 3999;

@DiagnosticParameter(
type = String.class,
Expand Down Expand Up @@ -112,7 +113,7 @@ private static boolean isValidDate(BSLParser.StringContext ctx) {

private static boolean isValidDate(String strDate) {
var year = parseInt(strDate.substring(0, 4));
if (year < 1 || year > 3999) {
if (year < 1 || year > MAX_YEAR_BY_1C) {
return false;
}
var month = parseInt(strDate.substring(4, 6));
Expand Down

0 comments on commit eccb841

Please sign in to comment.