1

I keep getting this error when I run checkstyle on my program:

    NonRefundable.java:20:28: Name 'flight_Num' must match pattern '^[a-z][a-zA-Z0-9]*$'.

I'm not sure what I need to do to correct this. Here are the comments for this particular error:

/** Comments.
  *
  * @param flight_Num the flight number.
  * @param trip_Data the information stored in the Itinerary object.
  * @param base_Fare the double representing the initial cost of the trip.
  * @param fare_AdjustmentFactor the number factored into the baseFare and 
            discountFactor used to calculate totalFare.
  * @param discount_Factor the number factored into baseFare and 
  *         fare_AdjustmentFactor to calculate totalFare.
  */
  NonRefundable(String flight_Num, Itinerary trip_Data, double base_Fare,
            double fare_AdjustmentFactor, double discount_Factor) {

     super(flight_Num, trip_Data, base_Fare, fare_AdjustmentFactor);
     this.discountFactor = discount_Factor;
  }
pirho
  • 10,579
  • 12
  • 42
  • 61
Evan F
  • 61
  • 1
  • 6
  • 10

3 Answers3

1

Name 'flight_Num' must match pattern '^[a-z][a-zA-Z0-9]*$'

means that the _ character in flight_Num is not allowed.

Chuidiang
  • 1,055
  • 6
  • 13
1

You may want to look at the checkstyle documentation, and I expect you will see this when you fix the first problem, but remove the underscore from the parameter names.

NonRefundable(String flightNum, Itinerary tripData, double baseFare,
        double fareAdjustmentFactor, double discountFactor)

http://checkstyle.sourceforge.net/config_naming.html

You can look at various style guides and the parameter name tends to be camel-cased, as shown in this particular one.

http://www.cwu.edu/~gellenbe/javastyle/parameter.html

James Black
  • 41,092
  • 9
  • 84
  • 162
0

Since Checkstyle 3.0

If it is not possible to remove the underscore it is possible to suppress this with:

// SUPPRESS CHECKSTYLE ParameterName
NonRefundable(...)

Related question

pirho
  • 10,579
  • 12
  • 42
  • 61