Skip to content

Commit

Permalink
Enable readability-inconsistent-declaration-parameter-name
Browse files Browse the repository at this point in the history
This check enforces that parameter names in declarations should match
those in definitions.
  • Loading branch information
jbytheway committed Aug 22, 2019
1 parent 5687d45 commit da53b5c
Show file tree
Hide file tree
Showing 52 changed files with 308 additions and 304 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ readability-*,\
-readability-else-after-return,\
-readability-function-size,\
-readability-implicit-bool-conversion,\
-readability-inconsistent-declaration-parameter-name,\
-readability-isolate-declaration,\
-readability-magic-numbers,\
-readability-named-parameter,\
Expand Down
22 changes: 12 additions & 10 deletions src/animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,27 +563,29 @@ void draw_line_curses( game &g, const tripoint &pos, const tripoint &center,
} //namespace

#if defined(TILES)
void game::draw_line( const tripoint &p, const tripoint &center, const std::vector<tripoint> &ret )
void game::draw_line( const tripoint &p, const tripoint &center,
const std::vector<tripoint> &points )
{
if( !u.sees( p ) ) {
return;
}

if( !use_tiles ) {
draw_line_curses( *this, p, center, ret ); // TODO: needed for tiles ver too??
draw_line_curses( *this, p, center, points ); // TODO: needed for tiles ver too??
return;
}

tilecontext->init_draw_line( p, ret, "line_target", true );
tilecontext->init_draw_line( p, points, "line_target", true );
}
#else
void game::draw_line( const tripoint &p, const tripoint &center, const std::vector<tripoint> &ret )
void game::draw_line( const tripoint &p, const tripoint &center,
const std::vector<tripoint> &points )
{
if( !u.sees( p ) ) {
return;
}

draw_line_curses( *this, p, center, ret );
draw_line_curses( *this, p, center, points );
}
#endif

Expand All @@ -602,17 +604,17 @@ void draw_line_curses( game &g, const std::vector<tripoint> &points )
} //namespace

#if defined(TILES)
void game::draw_line( const tripoint &p, const std::vector<tripoint> &vPoint )
void game::draw_line( const tripoint &p, const std::vector<tripoint> &points )
{
draw_line_curses( *this, vPoint );
tilecontext->init_draw_line( p, vPoint, "line_trail", false );
draw_line_curses( *this, points );
tilecontext->init_draw_line( p, points, "line_trail", false );
}
#else
void game::draw_line( const tripoint &p, const std::vector<tripoint> &vPoint )
void game::draw_line( const tripoint &p, const std::vector<tripoint> &points )
{
( void )p; //unused

draw_line_curses( *this, vPoint );
draw_line_curses( *this, points );
}
#endif

Expand Down
6 changes: 3 additions & 3 deletions src/auto_pickup.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class rule
rule( const std::string &r, const bool a, const bool e ) : sRule( r ), bActive( a ), bExclude( e ) {
}

void serialize( JsonOut &json ) const;
void serialize( JsonOut &jsout ) const;
void deserialize( JsonIn &jsin );

void test_pattern() const;
Expand All @@ -63,7 +63,7 @@ class rule
class rule_list : public std::vector<rule>
{
public:
void serialize( JsonOut &json ) const;
void serialize( JsonOut &jsout ) const;
void deserialize( JsonIn &jsin );

void load_legacy_rules( std::istream &fin );
Expand Down Expand Up @@ -156,7 +156,7 @@ class npc_settings : public base_settings

void show( const std::string &name );

void serialize( JsonOut &json ) const;
void serialize( JsonOut &jsout ) const;
void deserialize( JsonIn &jsin );

bool empty() const;
Expand Down
4 changes: 2 additions & 2 deletions src/avatar.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class avatar : public player

void store( JsonOut &json ) const;
void load( JsonObject &data );
void serialize( JsonOut &josn ) const override;
void deserialize( JsonIn &json ) override;
void serialize( JsonOut &json ) const override;
void deserialize( JsonIn &jsin ) override;
void serialize_map_memory( JsonOut &jsout ) const;
void deserialize_map_memory( JsonIn &jsin );

Expand Down
4 changes: 2 additions & 2 deletions src/basecamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class basecamp
std::string gathering_description( const std::string &bldg );
/// Returns a string for the number of plants that are harvestable, plots ready to plany,
/// and ground that needs tilling
std::string farm_description( const tripoint &omt_pos, size_t &plots_count,
std::string farm_description( const tripoint &farm_pos, size_t &plots_count,
farm_ops operation );
/// Returns the description of a camp crafting options. converts fire charges to charcoal,
/// allows dark crafting
Expand Down Expand Up @@ -271,7 +271,7 @@ class basecamp
* @param omt_trg the overmap pos3 of the farm_ops
* @param op whether to plow, plant, or harvest
*/
bool farm_return( const std::string &task, const tripoint &omt_trg, farm_ops op );
bool farm_return( const std::string &task, const tripoint &omt_tgt, farm_ops op );
void fortifications_return();

void combat_mission_return( const std::string &miss );
Expand Down
4 changes: 2 additions & 2 deletions src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2197,7 +2197,7 @@ void bionic::deserialize( JsonIn &jsin )
}

void player::introduce_into_anesthesia( const time_duration &duration, player &installer,
bool anesthetic ) //used by the Autodoc
bool needs_anesthesia ) //used by the Autodoc
{
installer.add_msg_player_or_npc( m_info,
_( "You set up the operation step-by-step, configuring the Autodoc to manipulate a CBM." ),
Expand All @@ -2206,7 +2206,7 @@ void player::introduce_into_anesthesia( const time_duration &duration, player &i
add_msg_player_or_npc( m_info,
_( "You settle into position, sliding your right wrist into the couch's strap." ),
_( "<npcname> settles into position, sliding their wrist into the couch's strap." ) );
if( anesthetic ) {
if( needs_anesthesia ) {
//post-threshold medical mutants do not fear operations.
if( has_trait( trait_THRESH_MEDICAL ) ) {
add_msg_if_player( m_mixed,
Expand Down
6 changes: 3 additions & 3 deletions src/cata_tiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class tileset_loader

void process_variations_after_loading( weighted_int_list<std::vector<int>> &v );

void add_ascii_subtile( tile_type &curr_tile, const std::string &t_id, int fg,
void add_ascii_subtile( tile_type &curr_tile, const std::string &t_id, int sprite_id,
const std::string &s_id );
void load_ascii_set( JsonObject &entry );
/**
Expand Down Expand Up @@ -309,8 +309,8 @@ class cata_tiles
/* Tile Picking */
void get_tile_values( int t, const int *tn, int &subtile, int &rotation );
void get_connect_values( const tripoint &p, int &subtile, int &rotation, int connect_group );
void get_terrain_orientation( const tripoint &p, int &rota, int &subtype );
void get_rotation_and_subtile( char val, int &rota, int &subtype );
void get_terrain_orientation( const tripoint &p, int &rota, int &subtile );
void get_rotation_and_subtile( char val, int &rota, int &subtile );

/** Drawing Layers */
bool apply_vision_effects( const tripoint &pos, visibility_type visibility );
Expand Down
12 changes: 6 additions & 6 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,11 @@ class Character : public Creature, public visitable<Character>

// In mutation.cpp
/** Returns true if the player has the entered trait */
bool has_trait( const trait_id &flag ) const override;
bool has_trait( const trait_id &b ) const override;
/** Returns true if the player has the entered starting trait */
bool has_base_trait( const trait_id &flag ) const;
bool has_base_trait( const trait_id &b ) const;
/** Returns true if player has a trait with a flag */
bool has_trait_flag( const std::string &flag ) const;
bool has_trait_flag( const std::string &b ) const;
/** Returns the trait id with the given invlet, or an empty string if no trait has that invlet */
trait_id trait_by_invlet( int ch ) const;

Expand Down Expand Up @@ -898,7 +898,7 @@ class Character : public Creature, public visitable<Character>
// how loud a character can shout. based on mutations and clothing
int get_shout_volume() const;
// shouts a message
void shout( std::string text = "", bool order = false );
void shout( std::string msg = "", bool order = false );
/** Handles Character vomiting effects */
void vomit();
// adds total healing to the bodypart. this is only a counter.
Expand Down Expand Up @@ -960,8 +960,8 @@ class Character : public Creature, public visitable<Character>
*/
std::vector<const mutation_branch *> cached_mutations;

void store( JsonOut &jsout ) const;
void load( JsonObject &jsin );
void store( JsonOut &json ) const;
void load( JsonObject &data );

// --------------- Values ---------------
pimpl<SkillLevelMap> _skills;
Expand Down
8 changes: 4 additions & 4 deletions src/cursesport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,23 +390,23 @@ inline void printstring( cata_cursesport::WINDOW *win, const std::string &text )
}

//Prints a formatted string to a window at the current cursor, base function
void catacurses::wprintw( const window &win, const std::string &printbuf )
void catacurses::wprintw( const window &win, const std::string &text )
{
if( !win ) {
// TODO: log this
return;
}

return printstring( win.get<cata_cursesport::WINDOW>(), printbuf );
return printstring( win.get<cata_cursesport::WINDOW>(), text );
}

//Prints a formatted string to a window, moves the cursor
void catacurses::mvwprintw( const window &win, const point &p, const std::string &printbuf )
void catacurses::mvwprintw( const window &win, const point &p, const std::string &text )
{
if( !wmove_internal( win, p ) ) {
return;
}
return printstring( win.get<cata_cursesport::WINDOW>(), printbuf );
return printstring( win.get<cata_cursesport::WINDOW>(), text );
}

//Resizes the underlying terminal after a Window's console resize(maybe?) Not used in TILES
Expand Down
20 changes: 10 additions & 10 deletions src/dialogue.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,26 @@ struct talk_effect_fun_t {

public:
talk_effect_fun_t() = default;
talk_effect_fun_t( talkfunction_ptr effect );
talk_effect_fun_t( std::function<void( npc & )> effect );
talk_effect_fun_t( std::function<void( const dialogue &d )> fun );
talk_effect_fun_t( talkfunction_ptr );
talk_effect_fun_t( std::function<void( npc & )> );
talk_effect_fun_t( std::function<void( const dialogue &d )> );
void set_companion_mission( const std::string &role_id );
void set_add_effect( JsonObject jo, const std::string &member, bool is_npc = false );
void set_remove_effect( JsonObject jo, const std::string &member, bool is_npc = false );
void set_add_trait( JsonObject jo, const std::string &member, bool is_npc = false );
void set_remove_trait( JsonObject jo, const std::string &member, bool is_npc = false );
void set_add_var( JsonObject jo, const std::string &member, bool is_npc = false );
void set_remove_var( JsonObject jo, const std::string &member, bool is_npc = false );
void set_u_buy_item( const std::string &new_trait, int cost, int count,
void set_u_buy_item( const std::string &item_name, int cost, int count,
const std::string &container_name );
void set_u_spend_cash( int amount );
void set_u_sell_item( const std::string &new_trait, int cost, int count );
void set_u_sell_item( const std::string &item_name, int cost, int count );
void set_consume_item( JsonObject jo, const std::string &member, int count,
bool is_npc = false );
void set_remove_item_with( JsonObject jo, const std::string &member, bool is_npc = false );
void set_npc_change_faction( const std::string &faction_name );
void set_npc_change_class( const std::string &faction_class );
void set_change_faction_rep( int amount );
void set_npc_change_class( const std::string &class_name );
void set_change_faction_rep( int rep_change );
void set_add_debt( const std::vector<trial_mod> &debt_modifiers );
void set_toggle_npc_rule( const std::string &rule );
void set_set_npc_rule( const std::string &rule );
Expand Down Expand Up @@ -156,12 +156,12 @@ struct talk_effect_t {
/**
* Sets an effect and consequence based on function pointer.
*/
void set_effect( talkfunction_ptr effect );
void set_effect( const talk_effect_fun_t &effect );
void set_effect( talkfunction_ptr );
void set_effect( const talk_effect_fun_t & );
/**
* Sets an effect to a function object and consequence to explicitly given one.
*/
void set_effect_consequence( const talk_effect_fun_t &eff, dialogue_consequence con );
void set_effect_consequence( const talk_effect_fun_t &fun, dialogue_consequence con );
void set_effect_consequence( std::function<void( npc &p )> ptr, dialogue_consequence con );

void load_effect( JsonObject &jo );
Expand Down
2 changes: 1 addition & 1 deletion src/faction.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class faction : public faction_template
faction( const faction_template &templ );

void deserialize( JsonIn &jsin );
void serialize( JsonOut &jsout ) const;
void serialize( JsonOut &json ) const;

std::string describe() const;

Expand Down
2 changes: 1 addition & 1 deletion src/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class field
* function returns true.
* @return True if the field was removed, false if it did not exist in the first place.
*/
bool remove_field( field_type_id type_to_remove );
bool remove_field( field_type_id field_to_remove );
/**
* Make sure to decrement the field counter in the submap.
* Removes the field entry, the iterator must point into @ref _field_type_list and must be valid.
Expand Down
23 changes: 12 additions & 11 deletions src/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class game
/** Returns the other end of the stairs (if any). May query, affect u etc. */
cata::optional<tripoint> find_or_make_stairs( map &mp, int z_after, bool &rope_ladder );
/** Actual z-level movement part of vertical_move. Doesn't include stair finding, traps etc. */
void vertical_shift( int dest_z );
void vertical_shift( int z_after );
/** Add goes up/down auto_notes (if turned on) */
void vertical_notes( int z_before, int z_after );
/** Checks to see if a player can use a computer (not illiterate, etc.) and uses if able. */
Expand Down Expand Up @@ -286,7 +286,7 @@ class game
/** Spawns a hallucination at a determined position. */
bool spawn_hallucination( const tripoint &p );
/** Swaps positions of two creatures */
bool swap_critters( Creature &first, Creature &second );
bool swap_critters( Creature &, Creature & );

private:
friend class monster_range;
Expand Down Expand Up @@ -405,16 +405,16 @@ class game
* If the monster was revived, the caller should remove the corpse item.
* If reviving failed, the item is unchanged, as is the environment (no new monsters).
*/
bool revive_corpse( const tripoint &location, item &corpse );
bool revive_corpse( const tripoint &p, item &it );
/**Turns Broken Cyborg monster into Cyborg NPC via surgery*/
void save_cyborg( item *cyborg, const tripoint &couch_pos, player &installer );
/** Asks if the player wants to cancel their activity, and if so cancels it. */
bool cancel_activity_query( const std::string &message );
bool cancel_activity_query( const std::string &text );
/** Asks if the player wants to cancel their activity and if so cancels it. Additionally checks
* if the player wants to ignore further distractions. */
bool cancel_activity_or_ignore_query( distraction_type type, const std::string &reason );
bool cancel_activity_or_ignore_query( distraction_type type, const std::string &text );
/** Handles players exiting from moving vehicles. */
void moving_vehicle_dismount( const tripoint &p );
void moving_vehicle_dismount( const tripoint &dest_loc );

/** Returns the current remotely controlled vehicle. */
vehicle *remoteveh();
Expand Down Expand Up @@ -510,7 +510,7 @@ class game
const tripoint &start_point, bool has_first_point, bool select_zone, bool peeking );

// Shared method to print "look around" info
void pre_print_all_tile_info( const tripoint &lp, const catacurses::window &w_look,
void pre_print_all_tile_info( const tripoint &lp, const catacurses::window &w_info,
int &line, int last_line, const visibility_variables &cache );

// Shared method to print "look around" info
Expand Down Expand Up @@ -606,12 +606,13 @@ class game
void knockback( std::vector<tripoint> &traj, int force, int stun, int dam_mult );

// Animation related functions
void draw_bullet( const tripoint &pos, int i, const std::vector<tripoint> &trajectory,
void draw_bullet( const tripoint &t, int i, const std::vector<tripoint> &trajectory,
char bullet );
void draw_hit_mon( const tripoint &p, const monster &critter, bool dead = false );
void draw_hit_mon( const tripoint &p, const monster &m, bool dead = false );
void draw_hit_player( const player &p, int dam );
void draw_line( const tripoint &p, const tripoint &center_point, const std::vector<tripoint> &ret );
void draw_line( const tripoint &p, const std::vector<tripoint> &ret );
void draw_line( const tripoint &p, const tripoint &center_point,
const std::vector<tripoint> &points );
void draw_line( const tripoint &p, const std::vector<tripoint> &points );
void draw_weather( const weather_printable &wPrint );
void draw_sct();
void draw_zones( const tripoint &start, const tripoint &end, const tripoint &offset );
Expand Down
8 changes: 4 additions & 4 deletions src/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class input_manager
* of the key. This acts as the inverse to get_keyname:
* <code>get_keyname(get_keycode(a), , true) == a</code>
*/
std::string get_keyname( int ch, input_event_t input_type, bool portable = false ) const;
std::string get_keyname( int ch, input_event_t inp_type, bool portable = false ) const;

/**
* curses getch() replacement.
Expand All @@ -272,7 +272,7 @@ class input_manager
* Use `input_context::(re)set_timeout()` when possible so timeout will be properly
* reset when entering a new input context.
*/
void set_timeout( int delay );
void set_timeout( int t );
void reset_timeout() {
set_timeout( -1 );
}
Expand Down Expand Up @@ -593,7 +593,7 @@ class input_context
* and returns the absolute map coordinate.
* Eventually this should be made more flexible.
*/
cata::optional<tripoint> get_coordinates( const catacurses::window &window );
cata::optional<tripoint> get_coordinates( const catacurses::window &capture_win_ );

// Below here are shortcuts for registering common key combinations.
void register_directions();
Expand Down Expand Up @@ -658,7 +658,7 @@ class input_context
* this method will cause CATA_INPUT_TIMEOUT events to be generated correctly,
* and will reset timeout correctly when a new input context is entered.
*/
void set_timeout( int timeout );
void set_timeout( int val );
void reset_timeout();
private:

Expand Down
Loading

0 comments on commit da53b5c

Please sign in to comment.