Skip to content

Commit

Permalink
spelling: fix some typos in code/javadoc/comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladlis authored and romani committed Apr 5, 2017
1 parent 5b16c53 commit 3bd3a52
Show file tree
Hide file tree
Showing 22 changed files with 53 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private static String printTree(DetailAST ast) {
*/
private static String getNodeInfo(DetailAST node) {
return TokenUtils.getTokenName(node.getType())
+ " -> " + excapeAllControlChars(node.getText())
+ " -> " + escapeAllControlChars(node.getText())
+ " [" + node.getLineNo() + ':' + node.getColumnNo() + ']';
}

Expand Down Expand Up @@ -198,11 +198,11 @@ private static String getIndentation(DetailAST ast) {
}

/**
* Replace all control chars with excaped symbols.
* Replace all control chars with escaped symbols.
* @param text the String to process.
* @return the processed String with all control chars excaped.
* @return the processed String with all control chars escaped.
*/
private static String excapeAllControlChars(String text) {
private static String escapeAllControlChars(String text) {
final String textWithoutNewlines = NEWLINE.matcher(text).replaceAll("\\\\n");
final String textWithoutReturns = RETURN.matcher(textWithoutNewlines).replaceAll("\\\\r");
return TAB.matcher(textWithoutReturns).replaceAll("\\\\t");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private static int calculateBufferLength(AuditEvent event, int severityLevelName

/**
* Returns check name without 'Check' suffix.
* @param event audit ivent.
* @param event audit event.
* @return check name without 'Check' suffix.
*/
private static String getCheckShortName(AuditEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static String printTree(DetailNode ast, String rootPrefix, String prefix)
}
messageBuilder.append(getIndentation(node))
.append(JavadocUtils.getTokenName(node.getType())).append(" -> ")
.append(JavadocUtils.excapeAllControlChars(node.getText())).append(" [")
.append(JavadocUtils.escapeAllControlChars(node.getText())).append(" [")
.append(node.getLineNumber()).append(':').append(node.getColumnNumber())
.append(']').append(LINE_SEPARATOR)
.append(printTree(JavadocUtils.getFirstChild(node), rootPrefix, prefix));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private Object createObject(String className) throws CheckstyleException {
instance = declaredConstructor.newInstance();
}
catch (final ReflectiveOperationException ex) {
throw new CheckstyleException("Unable to instatiate " + className, ex);
throw new CheckstyleException("Unable to instantiate " + className, ex);
}
}

Expand All @@ -245,7 +245,7 @@ private static void fillShortToFullModuleNamesMap() {
fillChecksFromAnnotationPackage();
fillChecksFromBlocksPackage();
fillChecksFromCodingPackage();
fillChecksFromDesingPackage();
fillChecksFromDesignPackage();
fillChecksFromHeaderPackage();
fillChecksFromImportsPackage();
fillChecksFromIndentationPackage();
Expand Down Expand Up @@ -394,7 +394,7 @@ private static void fillChecksFromCodingPackage() {
/**
* Fill short-to-full module names map with Checks from design package.
*/
private static void fillChecksFromDesingPackage() {
private static void fillChecksFromDesignPackage() {
NAME_TO_FULL_MODULE_NAME.put("DesignForExtensionCheck",
BASE_PACKAGE + ".checks.design.DesignForExtensionCheck");
NAME_TO_FULL_MODULE_NAME.put("FinalClassCheck",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private static Set<ExternalResource> loadExternalResources(Set<String> resourceL
}
catch (CheckstyleException ex) {
// if exception happened (configuration resource was not found, connection is not
// available, resouce is broken, etc), we need to calculate hash sum based on
// available, resource is broken, etc), we need to calculate hash sum based on
// exception object content in order to check whether problem is resolved later
// and/or the configuration is changed.
contentHashSum = getHashCodeBasedOnObjectContent(ex);
Expand All @@ -282,7 +282,7 @@ private static Set<ExternalResource> loadExternalResources(Set<String> resourceL
/**
* Loads the content of external resource.
* @param location external resource location.
* @return array of bytes which respresents the content of external resource in binary form.
* @return array of bytes which represents the content of external resource in binary form.
* @throws CheckstyleException if error while loading occurs.
*/
private static byte[] loadExternalResource(String location) throws CheckstyleException {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,11 @@ public void destroy() {

@Override
public Set<String> getExternalResourceLocations() {
final Set<String> orinaryChecksResources = getExternalResourceLocations(ordinaryChecks);
final Set<String> ordinaryChecksResources = getExternalResourceLocations(ordinaryChecks);
final Set<String> commentChecksResources = getExternalResourceLocations(commentChecks);
final int resultListSize = orinaryChecksResources.size() + commentChecksResources.size();
final int resultListSize = ordinaryChecksResources.size() + commentChecksResources.size();
final Set<String> resourceLocations = new HashSet<>(resultListSize);
resourceLocations.addAll(orinaryChecksResources);
resourceLocations.addAll(ordinaryChecksResources);
resourceLocations.addAll(commentChecksResources);
return resourceLocations;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private static void registerIntegralTypes(ConvertUtilsBean cub) {
*/
private static void registerCustomTypes(ConvertUtilsBean cub) {
cub.register(new PatternConverter(), Pattern.class);
cub.register(new ServerityLevelConverter(), SeverityLevel.class);
cub.register(new SeverityLevelConverter(), SeverityLevel.class);
cub.register(new ScopeConverter(), Scope.class);
cub.register(new UriConverter(), URI.class);
cub.register(new RelaxedAccessModifierArrayConverter(), AccessModifier[].class);
Expand Down Expand Up @@ -285,7 +285,7 @@ public Object convert(Class type, Object value) {
}

/** A converter that converts strings to severity level. */
private static class ServerityLevelConverter implements Converter {
private static class SeverityLevelConverter implements Converter {
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public Object convert(Class type, Object value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public interface ExternalResourceHolder {
* ATTENTION!
* If 'getExternalResourceLocations()' return null, there will be
* {@link NullPointerException} in {@link Checker}.
* Such behaviour will signal that your module (check or filter) is designed incorrectrly.
* It make sence to return an empty set from 'getExternalResourceLocations()'
* Such behaviour will signal that your module (check or filter) is designed incorrectly.
* It make sense to return an empty set from 'getExternalResourceLocations()'
* only for composite modules like {@link com.puppycrawl.tools.checkstyle.TreeWalker}.
* @return a set of external configuration resource locations which are used by the module.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public class TranslationCheck extends AbstractFileSetCheck {
private static final Log LOG = LogFactory.getLog(TranslationCheck.class);

/**
* Regexp string for default tranlsation files.
* Regexp string for default translation files.
* For example, messages.properties.
*/
private static final String DEFAULT_TRANSLATION_REGEXP = "^.+\\..+$";
Expand Down Expand Up @@ -159,10 +159,10 @@ public class TranslationCheck extends AbstractFileSetCheck {
/** File name format with language code. */
private static final String FILE_NAME_WITH_LANGUAGE_CODE_FORMATTER = "%s_%s.%s";

/** Formatting string to form regexp to validate required tranlsations file names. */
/** Formatting string to form regexp to validate required translations file names. */
private static final String REGEXP_FORMAT_TO_CHECK_REQUIRED_TRANSLATIONS =
"^%1$s\\_%2$s(\\_[A-Z]{2})?\\.%3$s$|^%1$s\\_%2$s\\_[A-Z]{2}\\_[A-Za-z]+\\.%3$s$";
/** Formatting string to form regexp to validate default tranlsations file names. */
/** Formatting string to form regexp to validate default translations file names. */
private static final String REGEXP_FORMAT_TO_CHECK_DEFAULT_TRANSLATIONS = "^%s\\.%s$";

/** The files to process. */
Expand Down Expand Up @@ -202,7 +202,7 @@ public void setRequiredTranslations(String... translationCodes) {
}

/**
* Validates the correctness of user specififed language codes for the check.
* Validates the correctness of user specified language codes for the check.
* @param languageCodes user specified language codes for the check.
*/
private void validateUserSpecifiedLanguageCodes(Set<String> languageCodes) {
Expand Down Expand Up @@ -411,7 +411,7 @@ else if (languageMatcher.matches()) {
else {
regexp = DEFAULT_TRANSLATION_REGEXP;
}
// We use substring(...) insead of replace(...), so that the regular expression does
// We use substring(...) instead of replace(...), so that the regular expression does
// not have to be compiled each time it is used inside 'replace' method.
final String removePattern = regexp.substring("^.+".length(), regexp.length());
return fileName.replaceAll(removePattern, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public void visitToken(DetailAST ast) {
/**
* Checks if ast is default in annotation
* @param ast ast to test.
* @return true if current ast is default and it is part of annatation.
* @return true if current ast is default and it is part of annotation.
*/
private boolean isDefaultInAnnotation(DetailAST ast) {
boolean isDefaultInAnnotation = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ else if (state.currentScopeState == STATE_STATIC_VARIABLE_DEF) {
* state({@code Scope}), if it is it updates substate or else it
* logs violation.
* @param modifiersAst modifiers to process
* @param state curent state
* @param state current state
* @param isStateValid is main state for given modifiers is valid
*/
private void processModifiersSubState(DetailAST modifiersAst, ScopeState state,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ private static boolean shouldRemoveFinalVariableCandidate(ScopeData scopeData, D
* }
* </p>
* @param variable variable.
* @return true if a variable which is declared ouside loop is used inside loop.
* @return true if a variable which is declared outside loop is used inside loop.
*/
private static boolean isUseOfExternalVariableInsideLoop(DetailAST variable) {
DetailAST loop2 = variable.getParent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ private String getIllegalInstantiation(String className) {
* Check import statements.
* @param className name of the class
* @return value of illegal instantiated type
* @noinspection StringContatenationInLoop
* @noinspection StringConcatenationInLoop
*/
private String checkImportStatements(String className) {
String illegalType = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ private static String convertToString(DetailAST ast) {
case TokenTypes.LABELED_STAT:
tokenText = ast.getFirstChild().getText() + ast.getText();
break;
// multyline tokens need to become singlelined
// multiline tokens need to become singlelined
case TokenTypes.COMMENT_CONTENT:
tokenText = JavadocUtils.excapeAllControlChars(ast.getText());
tokenText = JavadocUtils.escapeAllControlChars(ast.getText());
break;
default:
tokenText = ast.getText();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private String getQualifiedClassName(DetailAST classAst) {
* outer class.
* @param packageName package name, empty string on default package
* @param outerClassQualifiedName qualified name(package + class) of outer class,
* null if doesnt exist
* null if doesn't exist
* @param className class name
* @return qualified class name(package + class name)
*/
Expand Down Expand Up @@ -242,7 +242,7 @@ private static String getSuperClassName(DetailAST classAst) {

/**
* Checks if given super class name in extend clause match super class qualified name.
* @param superClassQualifiedName super class quaflieid name(with package)
* @param superClassQualifiedName super class qualified name (with package)
* @param superClassInExtendClause name in extend clause
* @return true if given super class name in extend clause match super class qualified name,
* false otherwise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private void visitComment(DetailAST comment) {
handleCommentInEmptyCaseBlock(prevStmt, comment, nextStmt);
}
else if (isFallThroughComment(prevStmt, nextStmt)) {
handleFallThroughtComment(prevStmt, comment, nextStmt);
handleFallThroughComment(prevStmt, comment, nextStmt);
}
else if (isInEmptyCodeBlock(prevStmt, nextStmt)) {
handleCommentInEmptyCodeBlock(comment, nextStmt);
Expand Down Expand Up @@ -199,7 +199,7 @@ private boolean isDistributedPreviousStatement(DetailAST comment) {

/**
* Checks whether the previous statement of a comment is a method call chain or
* string concatenation statemen distributed over two ore more lines.
* string concatenation statement distributed over two ore more lines.
* @param comment comment to check.
* @return true if the previous statement is a distributed expression.
*/
Expand Down Expand Up @@ -262,9 +262,9 @@ private static boolean isDefinition(DetailAST previousSibling) {
}

/**
* Checks whether the previous statement of a comment is a destributed return statement.
* Checks whether the previous statement of a comment is a distributed return statement.
* @param commentPreviousSibling previous sibling of the comment.
* @return true if the previous statement of a comment is a destributed return statement.
* @return true if the previous statement of a comment is a distributed return statement.
*/
private static boolean isDistributedReturnStatement(DetailAST commentPreviousSibling) {
boolean isDistributed = false;
Expand All @@ -280,9 +280,9 @@ private static boolean isDistributedReturnStatement(DetailAST commentPreviousSib
}

/**
* Checks whether the previous statement of a comment is a destributed throw statement.
* Checks whether the previous statement of a comment is a distributed throw statement.
* @param commentPreviousSibling previous sibling of the comment.
* @return true if the previous statement of a comment is a destributed throw statement.
* @return true if the previous statement of a comment is a distributed throw statement.
*/
private static boolean isDistributedThrowStatement(DetailAST commentPreviousSibling) {
boolean isDistributed = false;
Expand All @@ -298,9 +298,9 @@ private static boolean isDistributedThrowStatement(DetailAST commentPreviousSibl
}

/**
* Returns the first token of the destributed previous statement of comment.
* Returns the first token of the distributed previous statement of comment.
* @param comment comment to check.
* @return the first token of the destributed previous statement of comment.
* @return the first token of the distributed previous statement of comment.
*/
private static DetailAST getDistributedPreviousStatement(DetailAST comment) {
DetailAST currentToken = comment.getPreviousSibling();
Expand Down Expand Up @@ -399,7 +399,7 @@ private static boolean isInEmptyCodeBlock(DetailAST prevStmt, DetailAST nextStmt
}

/**
* Handles a comment which is plased within empty case block.
* Handles a comment which is placed within empty case block.
* Note, if comment is placed at the end of the empty case block, we have Checkstyle's
* limitations to clearly detect user intention of explanation target - above or below. The
* only case we can assume as a violation is when a single line comment within the empty case
Expand Down Expand Up @@ -460,8 +460,8 @@ private void handleCommentInEmptyCaseBlock(DetailAST prevStmt, DetailAST comment
* @param comment single line comment.
* @param nextStmt next statement.
*/
private void handleFallThroughtComment(DetailAST prevStmt, DetailAST comment,
DetailAST nextStmt) {
private void handleFallThroughComment(DetailAST prevStmt, DetailAST comment,
DetailAST nextStmt) {

if (!areSameLevelIndented(comment, prevStmt, nextStmt)) {
logMultilineIndentation(prevStmt, comment, nextStmt);
Expand All @@ -470,7 +470,7 @@ private void handleFallThroughtComment(DetailAST prevStmt, DetailAST comment,

/**
* Handles a comment which is placed at the end of non empty code block.
* Note, if single line comment is plcaed at the end of non empty block the comment should have
* Note, if single line comment is placed at the end of non empty block the comment should have
* the same indentation level as the previous statement. For example:
* <p>
* {@code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*
* <p>
* The basic idea behind this is that while
* pretty printers are sometimes convenient for reformats of
* pretty printers are sometimes convenient for reformatting of
* legacy code, they often either aren't configurable enough or
* just can't anticipate how format should be done. Sometimes this is
* personal preference, other times it is practical experience. In any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* When customizing the check, the properties are applied in a specific order.
* The fileExtensions property first picks only files that match any of the
* specific extensions supplied. Once files are matched against the
* fileExtensions, the match property is then used in conjuction with the
* fileExtensions, the match property is then used in conjunction with the
* patterns to determine if the check is looking for a match or mis-match on
* those files. If the fileNamePattern is supplied, the matching is only applied
* to the fileNamePattern and not the folderPattern. If no fileNamePattern is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ private boolean isNotRelevantSituation(DetailAST ast, int currentType) {
* This function is needed to recognise double brace initialization as valid,
* unfortunately its not possible to implement this functionality
* in isNotRelevantSituation method, because in this method when we return
* true(is not relevant) ast is later doesnt check at all. For example:
* true(is not relevant) ast is later doesn't check at all. For example:
* new Properties() {{setProperty("double curly braces", "are not a style error");
* }};
* For second left curly brace in first line when we would return true from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,11 @@ public static String getTagName(DetailNode javadocTagSection) {
}

/**
* Replace all control chars with excaped symbols.
* Replace all control chars with escaped symbols.
* @param text the String to process.
* @return the processed String with all control chars excaped.
* @return the processed String with all control chars escaped.
*/
public static String excapeAllControlChars(String text) {
public static String escapeAllControlChars(String text) {
final String textWithoutNewlines = NEWLINE.matcher(text).replaceAll("\\\\n");
final String textWithoutReturns = RETURN.matcher(textWithoutNewlines).replaceAll("\\\\r");
return TAB.matcher(textWithoutReturns).replaceAll("\\\\t");
Expand Down
Loading

0 comments on commit 3bd3a52

Please sign in to comment.