From b16e96a757ccee5be66fabb8e666823ca3cb558a Mon Sep 17 00:00:00 2001
From: Mauryan Kansara
Date: Sun, 7 Jul 2024 23:34:03 +0530
Subject: [PATCH] supplemental: Replaced the older version of google java style
guide with newer version and deleted unnecessary test class for Annotations
section
---
.../AnnotationLocationTest.java | 83 -------------------
.../indentation/CommentsIndentationCheck.java | 2 +-
.../naming/AbbreviationAsWordInNameCheck.java | 2 +-
.../indentation/CommentsIndentationCheck.xml | 2 +-
.../naming/AbbreviationAsWordInNameCheck.xml | 2 +-
src/xdocs/checks/misc/commentsindentation.xml | 2 +-
.../misc/commentsindentation.xml.template | 2 +-
.../naming/abbreviationaswordinname.xml | 2 +-
.../abbreviationaswordinname.xml.template | 2 +-
.../checks/naming/classtypeparametername.xml | 2 +-
.../classtypeparametername.xml.template | 2 +-
src/xdocs/google_style.xml | 66 +++++++--------
src/xdocs/index.xml.vm | 2 +-
13 files changed, 44 insertions(+), 127 deletions(-)
delete mode 100644 src/it/java/com/google/checkstyle/test/chapter4formatting/rule485annotations/AnnotationLocationTest.java
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
deleted file mode 100644
index e91ac726fe4..00000000000
--- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule485annotations/AnnotationLocationTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////
-// checkstyle: Checks Java source code and other text files for adherence to a set of rules.
-// Copyright (C) 2001-2024 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package com.google.checkstyle.test.chapter4formatting.rule485annotations;
-
-import org.junit.jupiter.api.Test;
-
-import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport;
-import com.puppycrawl.tools.checkstyle.api.Configuration;
-import com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocationCheck;
-
-public class AnnotationLocationTest extends AbstractGoogleModuleTestSupport {
-
- @Override
- protected String getPackageLocation() {
- return "com/google/checkstyle/test/chapter4formatting/rule485annotations";
- }
-
- @Test
- public void testAnnotation() throws Exception {
- final Class clazz = AnnotationLocationCheck.class;
- getCheckMessage(clazz, "annotation.location.alone");
- final Configuration checkConfig = getModuleConfig("AnnotationLocation",
- "AnnotationLocationMostCases");
-
- final String msgLocationAlone = "annotation.location.alone";
- final String msgLocation = "annotation.location";
- final String[] expected = {
- "3:16: " + getCheckMessage(clazz, msgLocationAlone, "MyAnnotation1"),
- "20:9: " + getCheckMessage(clazz, msgLocation, "MyAnnotation1", "8", "4"),
- "27:8: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "7", "4"),
- "31:9: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "8", "4"),
- "32:7: " + getCheckMessage(clazz, msgLocation, "MyAnnotation3", "6", "4"),
- "33:11: " + getCheckMessage(clazz, msgLocation, "MyAnnotation4", "10", "4"),
- "54:13: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "12", "8"),
- "58:13: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "12", "8"),
- "78:12: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "11", "8"),
- "81:11: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "10", "8"),
- "90:2: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "1", "0"),
- "93:1: " + getCheckMessage(clazz, msgLocationAlone, "MyAnnotationWithParam"),
- };
-
- final String filePath = getPath("InputAnnotationLocation.java");
-
- final Integer[] warnList = getLinesWithWarn(filePath);
- verify(checkConfig, filePath, expected, warnList);
- }
-
- @Test
- public void testAnnotationVariables() throws Exception {
- final Class clazz = AnnotationLocationCheck.class;
- getCheckMessage(clazz, "annotation.location.alone");
- final Configuration checkConfig = getModuleConfig("AnnotationLocation",
- "AnnotationLocationVariables");
-
- final String msgLocation = "annotation.location";
- final String[] expected = {
- "63:8: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "7", "4"),
- };
-
- final String filePath = getPath("InputAnnotationLocationVariables.java");
-
- final Integer[] warnList = getLinesWithWarn(filePath);
- verify(checkConfig, filePath, expected, warnList);
- }
-
-}
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java
index 0a423b82804..90a40d25615 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java
@@ -35,7 +35,7 @@
* Controls the indentation between comments and surrounding code.
* Comments are indented at the same level as the surrounding code.
* Detailed info about such convention can be found
- *
+ *
* here
*
* Validates abbreviations (consecutive capital letters) length in
* identifier name, it also allows to enforce camel case naming. Please read more at
- *
+ *
* Google Style Guide to get to know how to avoid long abbreviations in names.
*
*
'_' is considered as word separator in identifier name.
diff --git a/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/indentation/CommentsIndentationCheck.xml b/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/indentation/CommentsIndentationCheck.xml
index ae4f3ad2dfc..48aceb61872 100644
--- a/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/indentation/CommentsIndentationCheck.xml
+++ b/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/indentation/CommentsIndentationCheck.xml
@@ -8,7 +8,7 @@
Controls the indentation between comments and surrounding code.
Comments are indented at the same level as the surrounding code.
Detailed info about such convention can be found
- <a href="https://checkstyle.org/styleguides/google-java-style-20180523/javaguide.html#s4.8.6.1-block-comment-style">
+ <a href="https://checkstyle.org/styleguides/google-java-style-20220203/javaguide.html#s4.8.6.1-block-comment-style">
here</a>
</p>
diff --git a/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/naming/AbbreviationAsWordInNameCheck.xml b/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/naming/AbbreviationAsWordInNameCheck.xml
index db101deb46b..d89d3d664bf 100644
--- a/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/naming/AbbreviationAsWordInNameCheck.xml
+++ b/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/naming/AbbreviationAsWordInNameCheck.xml
@@ -7,7 +7,7 @@
<p>
Validates abbreviations (consecutive capital letters) length in
identifier name, it also allows to enforce camel case naming. Please read more at
- <a href="https://checkstyle.org/styleguides/google-java-style-20180523/javaguide.html#s5.3-camel-case">
+ <a href="https://checkstyle.org/styleguides/google-java-style-20220203/javaguide.html#s5.3-camel-case">
Google Style Guide</a> to get to know how to avoid long abbreviations in names.
</p>
<p>'_' is considered as word separator in identifier name.</p>
diff --git a/src/xdocs/checks/misc/commentsindentation.xml b/src/xdocs/checks/misc/commentsindentation.xml
index b323640bb55..29baa8ee0a2 100644
--- a/src/xdocs/checks/misc/commentsindentation.xml
+++ b/src/xdocs/checks/misc/commentsindentation.xml
@@ -13,7 +13,7 @@
Controls the indentation between comments and surrounding code.
Comments are indented at the same level as the surrounding code.
Detailed info about such convention can be found
-
+
here
diff --git a/src/xdocs/checks/misc/commentsindentation.xml.template b/src/xdocs/checks/misc/commentsindentation.xml.template
index b4c3ed3be9b..637eb6dc589 100644
--- a/src/xdocs/checks/misc/commentsindentation.xml.template
+++ b/src/xdocs/checks/misc/commentsindentation.xml.template
@@ -13,7 +13,7 @@
Controls the indentation between comments and surrounding code.
Comments are indented at the same level as the surrounding code.
Detailed info about such convention can be found
-
+
here
diff --git a/src/xdocs/checks/naming/abbreviationaswordinname.xml b/src/xdocs/checks/naming/abbreviationaswordinname.xml
index 484e38dd8cd..4d06180a095 100644
--- a/src/xdocs/checks/naming/abbreviationaswordinname.xml
+++ b/src/xdocs/checks/naming/abbreviationaswordinname.xml
@@ -12,7 +12,7 @@
Validates abbreviations (consecutive capital letters) length in identifier name,
it also allows to enforce camel case naming. Please read more at
-
+
Google Style Guide
to get to know how to avoid long abbreviations in names.
Validates abbreviations (consecutive capital letters) length in identifier name,
it also allows to enforce camel case naming. Please read more at
-
+
Google Style Guide
to get to know how to avoid long abbreviations in names.
diff --git a/src/xdocs/checks/naming/classtypeparametername.xml b/src/xdocs/checks/naming/classtypeparametername.xml
index 76e224cc6ea..6b8c2dafd20 100644
--- a/src/xdocs/checks/naming/classtypeparametername.xml
+++ b/src/xdocs/checks/naming/classtypeparametername.xml
@@ -78,7 +78,7 @@ class Example2 {
To configure the check for names that are camel case word with T as suffix
- (Google Style):
+ (Google Style):