yegor256 / qulice

Quality Police for Java projects: aggregator of Checkstyle and PMD
https://www.qulice.com
Other
301 stars 111 forks source link

Check for jcabi-log logger to disallow String.format #795

Open krzyk opened 8 years ago

krzyk commented 8 years ago

jcabi-log Logger supports formatting using standard %s, %d, etc., plus various extensions (http://log.jcabi.com/decors.html) so it is not needed to use String.format with it.

Create a check (you can look at InvalidSlf4jMessageFormat from pmd) that will fail a buld if jcabi-log Logger is provided with a String.format.

Invalid:

                final String message = String.format(                           
                    "Reducer does not exist: %s", reducer                       
                );                                                              
                Logger.error(this, message);                                    
Logger.info(this, String.format("Job %s deleted", job));

Valid:

Logger.info(this, "config exists for job: %s", id);
Logger.error(this, "#run(): %[exception]s", ex);
krzyk commented 8 years ago

@davvd valid bug

davvd commented 8 years ago

@davvd valid bug

@krzyk I just added bug tag here

davvd commented 8 years ago

@krzyk thank you for reporting this, I added 30 mins to your acc, transaction 95857375

krzyk commented 8 years ago

@davvd this is postponed

davvd commented 8 years ago

@davvd this is postponed

@krzyk OK, I put "postponed" label here

davvd commented 8 years ago

@davvd this is postponed

@krzyk right, I'll try to find someone else for this task