Skip to content

Instantly share code, notes, and snippets.

@maxov
Last active August 29, 2015 14:10
Show Gist options
  • Save maxov/47dffe6b764ac5757e3b to your computer and use it in GitHub Desktop.
Save maxov/47dffe6b764ac5757e3b to your computer and use it in GitHub Desktop.
Fixing formatting errors

Fixing Javadoc Formatting Errors

Problem

I found it necessary to fix some formatting errors. Here are the big types:

/**
 * @param param uncapitalized parameter or with period.
 * @return uncapitalized return or with period.
 */
void myMethod(Object param);

Solution

Here's what I did.

For punctuation errors:

  1. 'replace in path' in intellij
  2. find:
@(param|return)([^\*]*)\.\n

replace:

@$1$2\n
  1. intellij will go though with you over all occurrences. Click the replace button

For capitalization errors this cannot be solved with simple regex:

  1. 'find in path' in intellij
  2. set the find to case sensitive
  3. find:
@(param [^ ]* [a-z]|return [a-z])
  1. go through and correct the errors manually.

Notes

  1. This is still done through the ide manually. Need a checkstyle
  2. Does not match for multi-line errors. May need some more regex hacking but I'm too lazy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment