Merge remote-tracking branch 'lethosor/pre-commit' into develop

develop
lethosor 2022-04-12 21:17:15 -04:00
commit 0f464b13b3
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
119 changed files with 516 additions and 543 deletions

@ -5,7 +5,7 @@ on:
inputs: inputs:
pull_request: pull_request:
description: Pull request ID description: Pull request ID
type: number type: string
required: true # remove if we support commit rebuilds later required: true # remove if we support commit rebuilds later
jobs: jobs:

@ -0,0 +1,35 @@
ci:
autofix_prs: false
repos:
# shared across repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-xml
- id: check-yaml
- id: destroyed-symlinks
- id: end-of-file-fixer
- id: mixed-line-ending
args: ['--fix=lf']
- id: trailing-whitespace
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.14.2
hooks:
- id: check-github-workflows
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.13
hooks:
- id: forbid-tabs
exclude_types:
- json
- id: remove-tabs
exclude_types:
- json
# specific to dfhack:
exclude: '^(depends/|data/examples/.*\.json$|.*\.diff$)'

@ -13,4 +13,3 @@ find_package_handle_standard_args(Sphinx DEFAULT_MSG
) )
mark_as_advanced(SPHINX_EXECUTABLE) mark_as_advanced(SPHINX_EXECUTABLE)

@ -1,4 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
DFHack documentation build configuration file DFHack documentation build configuration file

@ -14,4 +14,3 @@ if(BUILD_TESTS)
DESTINATION blueprints/library/test DESTINATION blueprints/library/test
) )
endif() endif()

@ -58,4 +58,3 @@ u <- drainage level
,,,,,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r ,,,,,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r
,,,,,,,,,,,,r ,,,,,,,,,,,,r
,,,,,,,,,,,,r ,,,,,,,,,,,,r

Can't render this file because it has a wrong number of fields in line 38.

@ -2897,4 +2897,3 @@ build2_apartments/apartments_build2
,,,,n,`,h,,n,`,h,,n,`,h,,n,`,h,,n,`,h,,n,`,h,,n,`,h ,,,,n,`,h,,n,`,h,,n,`,h,,n,`,h,,n,`,h,,n,`,h,,n,`,h
,,,,`,~,`,,`,~,`,,`,~,`,,`,~,`,,`,~,`,,`,~,`,,`,~,` ,,,,`,~,`,,`,~,`,,`,~,`,,`,~,`,,`,~,`,,`,~,`,,`,~,`
,,,,n,`,f,,n,`,f,,n,`,f,,n,`,f,,n,`,f,,n,`,f,,n,`,f ,,,,n,`,f,,n,`,f,,n,`,f,,n,`,f,,n,`,f,,n,`,f,,n,`,f

Can't render this file because it has a wrong number of fields in line 58.

@ -150,4 +150,3 @@ Wilder
Wisdom Wisdom
Wyatt Wyatt
Zephyr Zephyr

@ -175,4 +175,3 @@ The script interface simply lets you designate one of the squads that
are assigned to the barracks/armory containing the selected stand as are assigned to the barracks/armory containing the selected stand as
the intended user. In order to aid in the choice, it shows the number the intended user. In order to aid in the choice, it shows the number
of currently assigned racks for every valid squad. of currently assigned racks for every valid squad.

@ -112,4 +112,3 @@ If you're not comfortable programming, you can help by:
All those things are crucial, and often under-represented. So if that's All those things are crucial, and often under-represented. So if that's
your thing, go get started! your thing, go get started!

@ -31,4 +31,3 @@ of DF-structures:
/library/xml/SYNTAX /library/xml/SYNTAX
/library/xml/how-to-update /library/xml/how-to-update

@ -18,4 +18,3 @@ These are pages relevant to people developing for DFHack.
/docs/Structures-intro /docs/Structures-intro
/docs/Memory-research /docs/Memory-research
/docs/Binpatches /docs/Binpatches

@ -131,4 +131,3 @@ namespace DFHack
}; };
} }
} }

@ -93,4 +93,3 @@ DFhackCExport int egg_sdl_event(SDL::Event* event);
// hook - ncurses event. return -1 to consume // hook - ncurses event. return -1 to consume
DFhackCExport int egg_curses_event(int orig_return); DFhackCExport int egg_curses_event(int orig_return);

@ -240,4 +240,3 @@ namespace LuaWrapper {
void AttachDFGlobals(lua_State *state); void AttachDFGlobals(lua_State *state);
}} }}

@ -57,4 +57,3 @@ namespace DFHack
}; };
} }
#endif //MODULE_H_INCLUDED #endif //MODULE_H_INCLUDED

@ -352,4 +352,3 @@ namespace DFHack
*/ */
DFHACK_EXPORT df::tiletype matchTileMaterial(df::tiletype source, df::tiletype_material tmat); DFHACK_EXPORT df::tiletype matchTileMaterial(df::tiletype source, df::tiletype_material tmat);
} }

@ -18,4 +18,3 @@ bool has_assignments()
{ {
return tile_bitmask.has_assignments(); return tile_bitmask.has_assignments();
} }

@ -207,4 +207,3 @@ DFHACK_EXPORT bool isSquadEquipment(df::item *item);
} }
} }

@ -112,4 +112,3 @@ namespace DFHack
DFHACK_EXPORT bool operator== (const df::job &a, const df::job &b); DFHACK_EXPORT bool operator== (const df::job &a, const df::job &b);
} }
#endif #endif

@ -383,4 +383,3 @@ namespace DFHack
}; };
} }
#endif #endif

@ -8,4 +8,3 @@ namespace DFHack {
DFHACK_EXPORT bool doOnce(std::string); DFHACK_EXPORT bool doOnce(std::string);
} }
} }

@ -110,4 +110,3 @@ namespace DFHack
} }
} }
#endif #endif

@ -44,4 +44,3 @@ function scheduleUnlessAlreadyScheduled(name,time,timeUnits,func)
end end
return _ENV return _ENV

@ -397,4 +397,3 @@ function GetTileTypeMat(typ, matspec, x, y, z)
end end
return _ENV return _ENV

@ -276,4 +276,3 @@ bool Burrows::setAssignedBlockTile(df::burrow *burrow, df::map_block *block, df:
return true; return true;
} }

@ -1254,4 +1254,3 @@ static void manageInteractionEvent(color_ostream& out) {
//TODO: deduce attacker from latest defend event first //TODO: deduce attacker from latest defend event first
} }
} }

@ -1153,4 +1153,3 @@ df::enums::biome_type::biome_type Maps::GetBiomeType(int world_coord_x, int worl
{ {
return Maps::GetBiomeTypeWithRef(world_coord_x, world_coord_y, world_coord_y); return Maps::GetBiomeTypeWithRef(world_coord_x, world_coord_y, world_coord_y);
} }

@ -13,4 +13,3 @@ bool DFHack::Once::alreadyDone(string bob) {
bool DFHack::Once::doOnce(string bob) { bool DFHack::Once::doOnce(string bob) {
return thingsDone.insert(bob).second; return thingsDone.insert(bob).second;
} }

@ -55,7 +55,7 @@ modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be author's reputation will not be affected by problems that might be
introduced by others. introduced by others.
Finally, software patents pose a constant threat to the existence of Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a effectively restrict the users of a free program by obtaining a
@ -111,7 +111,7 @@ modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The "work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must former contains code derived from the library, whereas the latter must
be combined with the library in order to run. be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@ -158,7 +158,7 @@ Library.
You may charge a fee for the physical act of transferring a copy, You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a and you may at your option offer warranty protection in exchange for a
fee. fee.
2. You may modify your copy or copies of the Library or any portion 2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1 distribute such modifications or work under the terms of Section 1
@ -216,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in that version instead if you wish.) Do not make any other change in
these notices. these notices.
Once this change is made in a given copy, it is irreversible for Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy. subsequent copies and derivative works made from that copy.
@ -267,7 +267,7 @@ Library will still fall under Section 6.)
distribute the object code for the work under the terms of Section 6. distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6, Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself. whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or 6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work work containing portions of the Library, and distribute that work
@ -329,7 +329,7 @@ restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you use both them and the Library together in an executable that you
distribute. distribute.
7. You may place library facilities that are a work based on the 7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined facilities not covered by this License, and distribute such a combined
@ -370,7 +370,7 @@ subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein. restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with You are not responsible for enforcing compliance by third parties with
this License. this License.
11. If, as a consequence of a court judgment or allegation of patent 11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues), infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or conditions are imposed on you (whether by court order, agreement or
@ -422,7 +422,7 @@ conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by license version number, you may choose any version ever published by
the Free Software Foundation. the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free 14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these, programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is write to the author to ask for permission. For software which is
@ -456,7 +456,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES. DAMAGES.
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest If you develop a new library, and you want it to be of the greatest

@ -453,4 +453,3 @@ static command_result autofarm(color_ostream& out, std::vector<std::string>& par
return CR_OK; return CR_OK;
} }

@ -194,4 +194,3 @@ void unitAttack(color_ostream& out, void* ptr) {
out.print(" %s\n", part->name_singular[0]->c_str()); out.print(" %s\n", part->name_singular[0]->c_str());
} }
} }

@ -32,4 +32,3 @@ command_result onceExample (color_ostream &out, std::vector <std::string> & para
} }
return CR_OK; return CR_OK;
} }

@ -273,4 +273,3 @@ static command_result stockcheck(color_ostream &out, vector <string> & parameter
return CR_OK; return CR_OK;
} }

@ -80,4 +80,3 @@ command_result df_gzoom (color_ostream &out, std::vector<std::string> & paramete
Gui::setViewCoords(x,y,z); Gui::setViewCoords(x,y,z);
return CR_OK; return CR_OK;
} }

@ -1543,4 +1543,3 @@ command_result digtype (color_ostream &out, vector <string> & parameters)
delete mCache; delete mCache;
return CR_OK; return CR_OK;
} }

@ -11,4 +11,3 @@
using namespace std; using namespace std;
int32_t assignJob(DFHack::color_ostream& out, Edge firstImportantEdge, unordered_map<df::coord,df::coord,PointHash> parentMap, unordered_map<df::coord,cost_t,PointHash>& costMap, vector<int32_t>& invaders, unordered_set<df::coord,PointHash>& requiresZNeg, unordered_set<df::coord,PointHash>& requiresZPos, MapExtras::MapCache& cache, DigAbilities& abilities); int32_t assignJob(DFHack::color_ostream& out, Edge firstImportantEdge, unordered_map<df::coord,df::coord,PointHash> parentMap, unordered_map<df::coord,cost_t,PointHash>& costMap, vector<int32_t>& invaders, unordered_set<df::coord,PointHash>& requiresZNeg, unordered_set<df::coord,PointHash>& requiresZPos, MapExtras::MapCache& cache, DigAbilities& abilities);

@ -631,5 +631,3 @@ df::coord getRoot(df::coord point, map<df::coord, df::coord>& rootMap) {
rootMap[point] = root; rootMap[point] = root;
return root; return root;
} }

@ -482,4 +482,3 @@ vector<Edge>* getEdgeSet(color_ostream &out, df::coord point, MapExtras::MapCach
return result; return result;
} }

@ -95,4 +95,3 @@ struct PointHash {
cost_t getEdgeCost(DFHack::color_ostream& out, df::coord pt1, df::coord pt2, DigAbilities& abilities); cost_t getEdgeCost(DFHack::color_ostream& out, df::coord pt1, df::coord pt2, DigAbilities& abilities);
std::vector<Edge>* getEdgeSet(DFHack::color_ostream &out, df::coord point, MapExtras::MapCache& cache, int32_t xMax, int32_t yMax, int32_t zMax, DigAbilities& abilities); std::vector<Edge>* getEdgeSet(DFHack::color_ostream &out, df::coord point, MapExtras::MapCache& cache, int32_t xMax, int32_t yMax, int32_t zMax, DigAbilities& abilities);

@ -2549,4 +2549,3 @@ void embark_assist::survey::shutdown() {
delete state; delete state;
state = nullptr; state = nullptr;
} }

@ -2458,4 +2458,3 @@ command_result labormanager(color_ostream &out, std::vector <std::string> & para
return CR_OK; return CR_OK;
} }
} }

@ -491,4 +491,3 @@ protected:
int display_max_rows; int display_max_rows;
int max_item_width; int max_item_width;
}; };

@ -204,4 +204,3 @@ command_result misery(color_ostream &out, vector<string>& parameters) {
return CR_OK; return CR_OK;
} }

@ -121,4 +121,3 @@ static command_result nestboxes(color_ostream &out, vector <string> & parameters
} }
return CR_OK; return CR_OK;
} }

@ -87,4 +87,3 @@ DFHACK_PLUGIN_LUA_FUNCTIONS {
DFHACK_LUA_FUNCTION(paintScreen), DFHACK_LUA_FUNCTION(paintScreen),
DFHACK_LUA_END DFHACK_LUA_END
}; };

@ -209,4 +209,3 @@ DFhackCExport command_result plugin_enable(color_ostream &out, bool enable)
return CR_OK; return CR_OK;
} }

@ -11,4 +11,3 @@ reaction_steam_engine
Dimension is the number of days it can produce 100 power * 100. Dimension is the number of days it can produce 100 power * 100.
I.e. with 2000 it means energy of 1 job = 1 water wheel for 20 days. I.e. with 2000 it means energy of 1 job = 1 water wheel for 20 days.
[PRODUCT:100:1:LIQUID_MISC:NONE:WATER][PRODUCT_DIMENSION:2000] [PRODUCT:100:1:LIQUID_MISC:NONE:WATER][PRODUCT_DIMENSION:2000]

@ -914,4 +914,3 @@ void CopyBuilding(int buildingIndex, RemoteFortressReader::BuildingInstance * re
break; break;
} }
} }

@ -11,5 +11,3 @@ DFHack::command_result GetSideMenu(DFHack::color_ostream &stream, const dfproto:
DFHack::command_result SetSideMenu(DFHack::color_ostream &stream, const DwarfControl::SidebarCommand *in); DFHack::command_result SetSideMenu(DFHack::color_ostream &stream, const DwarfControl::SidebarCommand *in);
#endif // !DWARF_CONTROL_H #endif // !DWARF_CONTROL_H

@ -59,4 +59,3 @@ command_result skeleton2 (color_ostream &out, std::vector <std::string> & parame
out.print("blah"); out.print("blah");
return CR_OK; return CR_OK;
} }

@ -44,4 +44,3 @@ public:
private: private:
OrganicMatLookup(); OrganicMatLookup();
}; };

@ -76,5 +76,3 @@ static inline bool is_dfstockfile ( const std::string& filename )
} }
// }}} utility Functions // }}} utility Functions

@ -544,7 +544,3 @@ DFHACK_PLUGIN_LUA_COMMANDS
DFHACK_LUA_COMMAND ( stockpiles_list_settings ), DFHACK_LUA_COMMAND ( stockpiles_list_settings ),
DFHACK_LUA_END DFHACK_LUA_END
}; };

@ -31,4 +31,3 @@ struct civ_agreement_view_hook : df::viewscreen_entityst {
}; };
IMPLEMENT_VMETHOD_INTERPOSE(civ_agreement_view_hook, render); IMPLEMENT_VMETHOD_INTERPOSE(civ_agreement_view_hook, render);

@ -45,4 +45,3 @@ struct fast_heat_hook : df::item_actual {
IMPLEMENT_VMETHOD_INTERPOSE(fast_heat_hook, updateTempFromMap); IMPLEMENT_VMETHOD_INTERPOSE(fast_heat_hook, updateTempFromMap);
IMPLEMENT_VMETHOD_INTERPOSE(fast_heat_hook, updateTemperature); IMPLEMENT_VMETHOD_INTERPOSE(fast_heat_hook, updateTemperature);
IMPLEMENT_VMETHOD_INTERPOSE(fast_heat_hook, adjustTemperature); IMPLEMENT_VMETHOD_INTERPOSE(fast_heat_hook, adjustTemperature);

@ -57,4 +57,3 @@ struct fast_trade_select_hook : df::viewscreen_tradegoodsst {
}; };
IMPLEMENT_VMETHOD_INTERPOSE(fast_trade_select_hook, feed); IMPLEMENT_VMETHOD_INTERPOSE(fast_trade_select_hook, feed);

@ -54,4 +54,3 @@ function test.invert_overwrite()
expect.eq(i.b, 2) expect.eq(i.b, 2)
expect.eq(i.a, 3) expect.eq(i.a, 3)
end end

@ -24,4 +24,3 @@ function test.index_id_bad()
expect.eq(df.global.world.units.other[df.units_other_id._last_item + 1], 'container') expect.eq(df.global.world.units.other[df.units_other_id._last_item + 1], 'container')
end) end)
end end