├── tests ├── with_jdex │ ├── flat_alt_zeros │ │ ├── altzeros │ │ ├── jdex │ │ │ ├── 10.02 An ID.md │ │ │ ├── 01.03 Area Standard Zero.md │ │ │ ├── 10.00 Me, Myself, and I.md │ │ │ ├── 00.00 System Area Management.md │ │ │ └── 01.00 Life Admin Area Management.md │ │ ├── files │ │ │ ├── 00-09 System │ │ │ │ └── 01 Life Admin │ │ │ │ │ └── 01.03 Area Standard Zero │ │ │ │ │ ├── File Inside ID │ │ │ │ │ └── Directory Inside Id │ │ │ │ │ └── .placeholder │ │ │ └── 10-19 Life Admin │ │ │ │ └── 10 Me, Myself, and I │ │ │ │ └── 10.02 An ID │ │ │ │ └── .placeholder │ │ └── result.json │ ├── area_not_in_jdex │ │ ├── jdex │ │ │ ├── 00.00 System.md │ │ │ ├── 01.02 A Name.md │ │ │ ├── 11.00 Cat.md │ │ │ ├── 11.12 ID.md │ │ │ ├── 01.03 Another ID.md │ │ │ └── 01.00 System Stuff.md │ │ ├── files │ │ │ ├── 10-19 Oops │ │ │ │ └── 11 Cat │ │ │ │ │ └── 11.12 ID │ │ │ │ │ └── .placeholder │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 A Name │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── flat_alt_zeros_with_headers │ │ ├── altzeros │ │ ├── jdex │ │ │ ├── 10.02 An ID.md │ │ │ ├── 10. Life Admin.md │ │ │ ├── 01.03 Area Standard Zero.md │ │ │ ├── 10.00 Me, Myself, and I.md │ │ │ ├── 00.00 System Area Management.md │ │ │ └── 01.00 Life Admin Area Management.md │ │ ├── files │ │ │ ├── 10-19 Life Admin │ │ │ │ └── 10 Me, Myself, and I │ │ │ │ │ └── 10.02 An ID │ │ │ │ │ └── .placeholder │ │ │ └── 00-09 System │ │ │ │ └── 01 Life Admin │ │ │ │ └── 01.03 Area Standard Zero │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── id_not_in_jdex │ │ ├── jdex │ │ │ ├── 00.00 System.md │ │ │ ├── 01.00 System Stuff.md │ │ │ └── 01.03 Another ID.md │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 Missing ID │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_duplicate_area_header │ │ ├── altzeros │ │ ├── jdex │ │ │ ├── 10. A Reuse.md │ │ │ ├── 10. An Area.md │ │ │ ├── 10.02 An Id.md │ │ │ ├── 01.00 An Area.md │ │ │ └── 10.00 A Category.md │ │ ├── files │ │ │ └── 10-19 An Area │ │ │ │ └── 10 A Category │ │ │ │ └── 10.02 An Id │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── category_not_in_jdex │ │ ├── jdex │ │ │ ├── 00.00 System.md │ │ │ ├── 01.02 An ID.md │ │ │ └── 01.03 Another ID.md │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 An ID │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── flat_alt_zeros_duplicate_header │ │ ├── altzeros │ │ ├── jdex │ │ │ ├── 10.02 An ID.md │ │ │ ├── 10. Life Admin.md │ │ │ ├── 10. Life Adminn.md │ │ │ ├── 01.03 Area Standard Zero.md │ │ │ ├── 10.00 Me, Myself, and I.md │ │ │ ├── 00.00 System Area Management.md │ │ │ └── 01.00 Life Admin Area Management.md │ │ ├── files │ │ │ ├── 10-19 Life Admin │ │ │ │ └── 10 Me, Myself, and I │ │ │ │ │ └── 10.02 An ID │ │ │ │ │ └── .placeholder │ │ │ └── 00-09 System │ │ │ │ └── 01 Life Admin │ │ │ │ └── 01.03 Area Standard Zero │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── id_different_from_jdex │ │ ├── jdex │ │ │ ├── 01.04 An ID.md │ │ │ ├── 00.00 System.md │ │ │ ├── 01.02 A Name.md │ │ │ ├── 01.03 Another ID.md │ │ │ └── 01.00 System Stuff.md │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.04 An ID │ │ │ │ └── Other File │ │ │ │ ├── 01.02 A Naem │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_area_header_without_area │ │ ├── altzeros │ │ ├── jdex │ │ │ ├── 10. Life Admin.md │ │ │ ├── 10.02 An ID.md │ │ │ ├── 20. Digital Stuff.md │ │ │ ├── 01.03 Area Standard Zero.md │ │ │ ├── 10.00 Me, Myself, and I.md │ │ │ ├── 00.00 System Area Management.md │ │ │ └── 01.00 Life Admin Area Management.md │ │ ├── files │ │ │ ├── 00-09 System │ │ │ │ └── 01 Life Admin │ │ │ │ │ └── 01.03 Area Standard Zero │ │ │ │ │ ├── File Inside ID │ │ │ │ │ └── Directory Inside Id │ │ │ │ │ └── .placeholder │ │ │ └── 10-19 Life Admin │ │ │ │ └── 10 Me, Myself, and I │ │ │ │ └── 10.02 An ID │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_duplicate_id_flat │ │ ├── jdex │ │ │ ├── 01.01 An ID.md │ │ │ ├── 00.00 An Area.md │ │ │ ├── 01.00 A Category.md │ │ │ └── 01.01 A Reuse.md │ │ ├── files │ │ │ └── 00-09 An Area │ │ │ │ └── 01 A Category │ │ │ │ └── 01.00 An ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_file_outside_category │ │ ├── jdex │ │ │ ├── Not here │ │ │ └── 00-09 System │ │ │ │ ├── Nor here │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 A Name.md │ │ │ │ └── 01.03 Another ID.md │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 A Name │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── flat_with_index_suffix │ │ ├── jdex │ │ │ ├── 01.02 A Name.md │ │ │ ├── 01.03 Another ID.md │ │ │ ├── 00.00 System Index.md │ │ │ └── 01.00 System Stuff Index.md │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 A Name │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_area_header_different_from_area │ │ ├── altzeros │ │ ├── jdex │ │ │ ├── 10.02 An ID.md │ │ │ ├── 10. Life Adminn.md │ │ │ ├── 01.03 Area Standard Zero.md │ │ │ ├── 10.00 Me, Myself, and I.md │ │ │ ├── 00.00 System Area Management.md │ │ │ └── 01.00 Life Admin Area Management.md │ │ ├── files │ │ │ ├── 10-19 Life Admin │ │ │ │ └── 10 Me, Myself, and I │ │ │ │ │ └── 10.02 An ID │ │ │ │ │ └── .placeholder │ │ │ └── 00-09 System │ │ │ │ └── 01 Life Admin │ │ │ │ └── 01.03 Area Standard Zero │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_duplicate_area_flat │ │ ├── jdex │ │ │ ├── 00.00 A Reuse.md │ │ │ ├── 00.00 An Area.md │ │ │ ├── 01.01 An ID.md │ │ │ ├── 02.00 An Id.md │ │ │ └── 01.00 A Category.md │ │ ├── files │ │ │ └── 00-09 An Area │ │ │ │ └── 01 A Category │ │ │ │ └── 01.00 An ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_invalid_id_name_flat │ │ ├── jdex │ │ │ ├── 00.00 System.md │ │ │ ├── 01.02 A Name.md │ │ │ ├── 01.04 An ID.md │ │ │ ├── No Numbers.md │ │ │ ├── 01.00 System Stuff.md │ │ │ ├── 01.03 Another ID.md │ │ │ └── 01.5 Malformed Numbers.md │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 A Name │ │ │ │ └── .placeholder │ │ │ │ ├── 01.04 An ID │ │ │ │ └── Other File │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── area_different_from_jdex_flat │ │ ├── jdex │ │ │ ├── 00.00 System.md │ │ │ ├── 01.02 A Name.md │ │ │ ├── 01.00 System Stuff.md │ │ │ └── 01.03 Another ID.md │ │ ├── files │ │ │ └── 00-09 Systme │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 A Name │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── flat_with_management_suffixes │ │ ├── jdex │ │ │ ├── 01.02 A Name.md │ │ │ ├── 01.03 Another ID.md │ │ │ ├── 00.00 System Area Management.md │ │ │ └── 01.00 System Stuff Category Management.md │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 A Name │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_duplicate_category_flat │ │ ├── jdex │ │ │ ├── 00.00 An Area.md │ │ │ ├── 01.00 A Reuse.md │ │ │ ├── 01.01 An ID.md │ │ │ ├── 02.00 An Id.md │ │ │ └── 01.00 A Category.md │ │ ├── files │ │ │ └── 00-09 An Area │ │ │ │ └── 01 A Category │ │ │ │ └── 01.00 An ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_invalid_area_name │ │ ├── jdex │ │ │ ├── No Numbers │ │ │ │ └── .placeholder │ │ │ ├── 10-18 Malformed Numbers │ │ │ │ └── .placeholder │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 A Name.md │ │ │ │ └── 01.03 Another ID.md │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 A Name │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── category_different_from_jdex_flat │ │ ├── jdex │ │ │ ├── 00.00 System.md │ │ │ ├── 01.02 A Name.md │ │ │ ├── 01.00 System Stuff.md │ │ │ └── 01.03 Another ID.md │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuf │ │ │ │ ├── 01.02 A Name │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_in_folders │ │ ├── jdex │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 A Name.md │ │ │ │ └── 01.03 Another ID.md │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 A Naem │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_category_in_wrong_area │ │ ├── jdex │ │ │ └── 00-09 System │ │ │ │ ├── 11 Whoops │ │ │ │ └── 11.01 Inbox.md │ │ │ │ └── 01 System Stuff │ │ │ │ └── 01.00 An ID.md │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ └── 01.00 An ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_duplicate_area_nested │ │ ├── jdex │ │ │ ├── 00-09 An Area │ │ │ │ └── 01 A Category │ │ │ │ │ └── 01.00 An ID │ │ │ └── 00-09 A Reuse │ │ │ │ └── 02 Another Category │ │ │ │ └── 02.00 An Id │ │ ├── files │ │ │ └── 00-09 An Area │ │ │ │ └── 01 A Category │ │ │ │ └── 01.00 An ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_duplicate_id_nested │ │ ├── jdex │ │ │ └── 00-09 An Area │ │ │ │ └── 01 A Category │ │ │ │ ├── 01.01 An ID.md │ │ │ │ └── 01.01 A Reuse.md │ │ ├── files │ │ │ └── 00-09 An Area │ │ │ │ └── 01 A Category │ │ │ │ └── 01.00 An ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_invalid_category_name │ │ ├── jdex │ │ │ └── 00-09 System │ │ │ │ ├── No Numbers │ │ │ │ └── .placeholder │ │ │ │ ├── 01 System Stuff │ │ │ │ ├── 01.02 A Name.md │ │ │ │ └── 01.03 Another ID.md │ │ │ │ └── 2 Malformed Numbers │ │ │ │ └── .placeholder │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 A Name │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_invalid_id_name_nested │ │ ├── jdex │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── No ID.md │ │ │ │ ├── 01.02 A Name.md │ │ │ │ ├── 01.03 Another ID.md │ │ │ │ └── 01.4 Malformed Numbers.md │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 A Name │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_duplicate_category_nested │ │ ├── jdex │ │ │ └── 00-09 An Area │ │ │ │ ├── 01 A Category │ │ │ │ └── 01.00 An ID │ │ │ │ └── 01 A Reuse │ │ │ │ └── 01.02 Another ID │ │ ├── files │ │ │ └── 00-09 An Area │ │ │ │ └── 01 A Category │ │ │ │ └── 01.00 An ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── jdex_id_in_wrong_category │ │ ├── jdex │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.00 An ID.md │ │ │ │ └── 02.00 Whoops.md │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ └── 01.00 An ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ ├── single_file_jdex │ │ ├── files │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.02 A Naem │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ ├── jdex │ │ └── result.json │ ├── area_different_from_jdex_nested │ │ ├── jdex │ │ │ └── 00-09 System │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.00 An ID.md │ │ │ │ ├── 01.02 A Name.md │ │ │ │ └── 01.03 Another ID.md │ │ ├── files │ │ │ └── 00-09 Systme │ │ │ │ └── 01 System Stuff │ │ │ │ ├── 01.00 An ID │ │ │ │ └── Other File │ │ │ │ ├── 01.02 A Name │ │ │ │ └── .placeholder │ │ │ │ └── 01.03 Another ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── result.json │ └── category_different_from_jdex_nested │ │ ├── jdex │ │ └── 00-09 System │ │ │ └── 01 System Stuff │ │ │ ├── 01.00 An ID.md │ │ │ ├── 01.02 A Name.md │ │ │ └── 01.03 Another ID.md │ │ ├── files │ │ └── 00-09 System │ │ │ └── 01 System Stuf │ │ │ ├── 01.00 An ID │ │ │ └── Other File │ │ │ ├── 01.02 A Name │ │ │ └── .placeholder │ │ │ └── 01.03 Another ID │ │ │ ├── File Inside ID │ │ │ └── Directory Inside Id │ │ │ └── .placeholder │ │ └── result.json └── without_jdex │ ├── ignore_files │ ├── files │ │ ├── .ignoreme │ │ └── 00-09 System │ │ │ ├── ignoreme │ │ │ └── 01 System Stuff │ │ │ ├── .ignoreme2 │ │ │ ├── ignoreme │ │ │ └── 01.00 An ID │ │ │ ├── File Inside ID │ │ │ └── Directory Inside Id │ │ │ └── .placeholder │ ├── ignore │ └── result.json │ ├── file_outside_id │ ├── files │ │ ├── File Outside Area │ │ └── 00-09 System │ │ │ ├── File Outside Category │ │ │ └── 01 System Stuff │ │ │ ├── File Outside Id │ │ │ └── 01.00 An ID │ │ │ ├── File Inside ID │ │ │ └── Directory Inside Id │ │ │ └── .placeholder │ └── result.json │ ├── invalid_area_name │ ├── files │ │ ├── No ID │ │ │ └── .placeholder │ │ ├── 10-18 Malformed │ │ │ └── .placeholder │ │ └── 00-09 System │ │ │ └── 01 System Stuff │ │ │ └── 01.00 An ID │ │ │ ├── File Inside ID │ │ │ └── Directory Inside Id │ │ │ └── .placeholder │ └── result.json │ ├── invalid_category_name │ ├── files │ │ └── 00-09 System │ │ │ ├── No ID │ │ │ └── .placeholder │ │ │ ├── 2 Malformed │ │ │ └── .placeholder │ │ │ └── 01 System Stuff │ │ │ └── 01.00 An ID │ │ │ ├── File Inside ID │ │ │ └── Directory Inside Id │ │ │ └── .placeholder │ └── result.json │ ├── invalid_id_name │ ├── files │ │ └── 00-09 System │ │ │ └── 01 System Stuff │ │ │ ├── No ID │ │ │ └── .placeholder │ │ │ ├── 01.00 An ID │ │ │ ├── File Inside ID │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ │ └── 01.1 Malformed │ │ │ └── .placeholder │ └── result.json │ ├── duplicate_id │ ├── files │ │ └── 00-09 System │ │ │ └── 01 System Stuff │ │ │ ├── 01.00 A Reuse │ │ │ └── Other File │ │ │ └── 01.00 An ID │ │ │ ├── File Inside ID │ │ │ └── Directory Inside Id │ │ │ └── .placeholder │ └── result.json │ ├── nonempty_inbox │ ├── files │ │ └── 00-09 System │ │ │ └── 01 System Stuff │ │ │ ├── 01.01 Inbox │ │ │ ├── Not This │ │ │ └── Or This │ │ │ │ └── .placeholder │ │ │ └── 01.00 An ID │ │ │ ├── File Inside ID │ │ │ └── Directory Inside Id │ │ │ └── .placeholder │ └── result.json │ ├── category_in_wrong_area │ ├── files │ │ └── 00-09 System │ │ │ ├── 11 Whoops │ │ │ └── 11.01 Inbox │ │ │ │ └── .placeholder │ │ │ └── 01 System Stuff │ │ │ └── 01.00 An ID │ │ │ ├── File Inside ID │ │ │ └── Directory Inside Id │ │ │ └── .placeholder │ └── result.json │ ├── duplicate_area │ ├── files │ │ ├── 00-09 An Area │ │ │ └── 01 A Category │ │ │ │ └── 01.00 An ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ └── 00-09 A Reuse │ │ │ └── 02 Another Category │ │ │ └── 02.00 An ID │ │ │ ├── File Inside ID │ │ │ └── Directory Inside Id │ │ │ └── .placeholder │ └── result.json │ ├── duplicate_category │ ├── files │ │ └── 00-09 System │ │ │ ├── 01 A Category │ │ │ └── 01.00 An ID │ │ │ │ ├── File Inside ID │ │ │ │ └── Directory Inside Id │ │ │ │ └── .placeholder │ │ │ └── 01 A Reuse │ │ │ └── 01.02 Another ID │ │ │ ├── File Inside ID │ │ │ └── Directory Inside Id │ │ │ └── .placeholder │ └── result.json │ └── id_in_wrong_category │ ├── files │ └── 00-09 System │ │ └── 01 System Stuff │ │ ├── 01.00 An ID │ │ ├── File Inside ID │ │ └── Directory Inside Id │ │ │ └── .placeholder │ │ └── 11.01 Whoops │ │ └── .placeholder │ └── result.json ├── .gitignore ├── images └── header_note.png ├── CHANGELOG.md ├── .github └── workflows │ └── test.yml ├── run_tests.py ├── README.md ├── LICENSE └── jdlint.py /tests/with_jdex/flat_alt_zeros/altzeros: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/ignore_files/files/.ignoreme: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .venv 2 | __pycache__ 3 | .mypy_cache 4 | -------------------------------------------------------------------------------- /tests/with_jdex/area_not_in_jdex/jdex/00.00 System.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_not_in_jdex/jdex/01.02 A Name.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_not_in_jdex/jdex/11.00 Cat.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_not_in_jdex/jdex/11.12 ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros/jdex/10.02 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_with_headers/altzeros: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/id_not_in_jdex/jdex/00.00 System.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_header/altzeros: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_not_in_jdex/jdex/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_not_in_jdex/jdex/00.00 System.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_not_in_jdex/jdex/01.02 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_duplicate_header/altzeros: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/id_different_from_jdex/jdex/01.04 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/id_not_in_jdex/jdex/01.00 System Stuff.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/id_not_in_jdex/jdex/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_without_area/altzeros: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_id_flat/jdex/01.01 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_file_outside_category/jdex/Not here: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/file_outside_id/files/File Outside Area: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_not_in_jdex/jdex/01.00 System Stuff.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_not_in_jdex/jdex/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros/jdex/01.03 Area Standard Zero.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros/jdex/10.00 Me, Myself, and I.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_with_headers/jdex/10.02 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_index_suffix/jdex/01.02 A Name.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_index_suffix/jdex/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/id_different_from_jdex/jdex/00.00 System.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/id_different_from_jdex/jdex/01.02 A Name.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/id_different_from_jdex/jdex/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_different_from_area/altzeros: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_flat/jdex/00.00 A Reuse.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_flat/jdex/00.00 An Area.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_flat/jdex/01.01 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_flat/jdex/02.00 An Id.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_header/jdex/10. A Reuse.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_header/jdex/10. An Area.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_header/jdex/10.02 An Id.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_id_flat/jdex/00.00 An Area.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_id_flat/jdex/01.00 A Category.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_id_flat/jdex/01.01 A Reuse.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_flat/jdex/00.00 System.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_flat/jdex/01.02 A Name.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_flat/jdex/01.04 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_flat/jdex/No Numbers.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/ignore_files/files/00-09 System/ignoreme: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/ignore_files/ignore: -------------------------------------------------------------------------------- 1 | .* 2 | */ignoreme 3 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_area_name/files/No ID/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_flat/jdex/00.00 System.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_flat/jdex/01.02 A Name.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros/jdex/00.00 System Area Management.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_duplicate_header/jdex/10.02 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_with_headers/jdex/10. Life Admin.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_index_suffix/jdex/00.00 System Index.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_management_suffixes/jdex/01.02 A Name.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/id_different_from_jdex/jdex/01.00 System Stuff.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_without_area/jdex/10. Life Admin.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_without_area/jdex/10.02 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_flat/jdex/01.00 A Category.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_header/jdex/01.00 An Area.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_header/jdex/10.00 A Category.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_category_flat/jdex/00.00 An Area.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_category_flat/jdex/01.00 A Reuse.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_category_flat/jdex/01.01 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_category_flat/jdex/02.00 An Id.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_area_name/jdex/No Numbers/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_flat/jdex/01.00 System Stuff.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_flat/jdex/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_flat/jdex/01.00 System Stuff.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_flat/jdex/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_flat/jdex/00.00 System.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_flat/jdex/01.02 A Name.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros/jdex/01.00 Life Admin Area Management.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_duplicate_header/jdex/10. Life Admin.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_duplicate_header/jdex/10. Life Adminn.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_index_suffix/jdex/01.00 System Stuff Index.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_management_suffixes/jdex/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_different_from_area/jdex/10.02 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_without_area/jdex/20. Digital Stuff.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_category_flat/jdex/01.00 A Category.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_file_outside_category/jdex/00-09 System/Nor here: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_flat/jdex/01.5 Malformed Numbers.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_area_name/files/10-18 Malformed/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_not_in_jdex/files/10-19 Oops/11 Cat/11.12 ID/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_flat/jdex/01.00 System Stuff.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_flat/jdex/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_with_headers/jdex/01.03 Area Standard Zero.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_with_headers/jdex/10.00 Me, Myself, and I.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_different_from_area/jdex/10. Life Adminn.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_without_area/jdex/01.03 Area Standard Zero.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_without_area/jdex/10.00 Me, Myself, and I.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/file_outside_id/files/00-09 System/File Outside Category: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/ignore_files/files/00-09 System/01 System Stuff/.ignoreme2: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/ignore_files/files/00-09 System/01 System Stuff/ignoreme: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_category_name/files/00-09 System/No ID/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_duplicate_header/jdex/01.03 Area Standard Zero.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_duplicate_header/jdex/10.00 Me, Myself, and I.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_with_headers/jdex/00.00 System Area Management.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_management_suffixes/jdex/00.00 System Area Management.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_without_area/jdex/00.00 System Area Management.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_in_folders/jdex/00-09 System/01 System Stuff/01.02 A Name.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_area_name/jdex/10-18 Malformed Numbers/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_duplicate_header/jdex/00.00 System Area Management.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_duplicate_header/jdex/01.00 Life Admin Area Management.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_with_headers/jdex/01.00 Life Admin Area Management.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_different_from_area/jdex/01.03 Area Standard Zero.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_different_from_area/jdex/10.00 Me, Myself, and I.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_without_area/jdex/01.00 Life Admin Area Management.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_category_in_wrong_area/jdex/00-09 System/11 Whoops/11.01 Inbox.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_nested/jdex/00-09 An Area/01 A Category/01.00 An ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_id_nested/jdex/00-09 An Area/01 A Category/01.01 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_in_folders/jdex/00-09 System/01 System Stuff/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_area_name/jdex/00-09 System/01 System Stuff/01.02 A Name.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_category_name/jdex/00-09 System/No Numbers/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_nested/jdex/00-09 System/01 System Stuff/No ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/file_outside_id/files/00-09 System/01 System Stuff/File Outside Id: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_category_name/files/00-09 System/2 Malformed/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_id_name/files/00-09 System/01 System Stuff/No ID/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_not_in_jdex/files/00-09 System/01 System Stuff/01.02 A Name/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_management_suffixes/jdex/01.00 System Stuff Category Management.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_different_from_area/jdex/00.00 System Area Management.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_different_from_area/jdex/01.00 Life Admin Area Management.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_category_in_wrong_area/jdex/00-09 System/01 System Stuff/01.00 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_nested/jdex/00-09 A Reuse/02 Another Category/02.00 An Id: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_category_nested/jdex/00-09 An Area/01 A Category/01.00 An ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_category_nested/jdex/00-09 An Area/01 A Reuse/01.02 Another ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_id_nested/jdex/00-09 An Area/01 A Category/01.01 A Reuse.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_file_outside_category/jdex/00-09 System/01 System Stuff/01.02 A Name.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_id_in_wrong_category/jdex/00-09 System/01 System Stuff/01.00 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_id_in_wrong_category/jdex/00-09 System/01 System Stuff/02.00 Whoops.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_in_folders/files/00-09 System/01 System Stuff/01.02 A Naem/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_area_name/jdex/00-09 System/01 System Stuff/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_category_name/jdex/00-09 System/01 System Stuff/01.02 A Name.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_category_name/jdex/00-09 System/2 Malformed Numbers/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_nested/jdex/00-09 System/01 System Stuff/01.02 A Name.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/single_file_jdex/files/00-09 System/01 System Stuff/01.02 A Naem/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/duplicate_id/files/00-09 System/01 System Stuff/01.00 A Reuse/Other File: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/duplicate_id/files/00-09 System/01 System Stuff/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/ignore_files/files/00-09 System/01 System Stuff/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/nonempty_inbox/files/00-09 System/01 System Stuff/01.01 Inbox/Not This: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/header_note.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SiriusStarr/jdlint/HEAD/images/header_note.png -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_nested/jdex/00-09 System/01 System Stuff/01.00 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_nested/jdex/00-09 System/01 System Stuff/01.02 A Name.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_not_in_jdex/files/00-09 System/01 System Stuff/01.02 An ID/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/id_different_from_jdex/files/00-09 System/01 System Stuff/01.04 An ID/Other File: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/id_not_in_jdex/files/00-09 System/01 System Stuff/01.02 Missing ID/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/id_not_in_jdex/files/00-09 System/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_file_outside_category/jdex/00-09 System/01 System Stuff/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_in_folders/files/00-09 System/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_category_name/jdex/00-09 System/01 System Stuff/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_nested/jdex/00-09 System/01 System Stuff/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/category_in_wrong_area/files/00-09 System/11 Whoops/11.01 Inbox/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/duplicate_area/files/00-09 An Area/01 A Category/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/duplicate_category/files/00-09 System/01 A Category/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/file_outside_id/files/00-09 System/01 System Stuff/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_area_name/files/00-09 System/01 System Stuff/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_id_name/files/00-09 System/01 System Stuff/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_id_name/files/00-09 System/01 System Stuff/01.1 Malformed/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/nonempty_inbox/files/00-09 System/01 System Stuff/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_nested/jdex/00-09 System/01 System Stuff/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_not_in_jdex/files/00-09 System/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_nested/jdex/00-09 System/01 System Stuff/01.00 An ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_nested/jdex/00-09 System/01 System Stuff/01.02 A Name.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_not_in_jdex/files/00-09 System/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros/files/00-09 System/01 Life Admin/01.03 Area Standard Zero/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros/files/10-19 Life Admin/10 Me, Myself, and I/10.02 An ID/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [] 4 | } 5 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_index_suffix/files/00-09 System/01 System Stuff/01.02 A Name/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/id_different_from_jdex/files/00-09 System/01 System Stuff/01.02 A Naem/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_flat/files/00-09 An Area/01 A Category/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_header/files/10-19 An Area/10 A Category/10.02 An Id/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_nested/files/00-09 An Area/01 A Category/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_id_flat/files/00-09 An Area/01 A Category/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_id_nested/files/00-09 An Area/01 A Category/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_file_outside_category/files/00-09 System/01 System Stuff/01.02 A Name/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_id_in_wrong_category/files/00-09 System/01 System Stuff/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_area_name/files/00-09 System/01 System Stuff/01.02 A Name/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_category_name/files/00-09 System/01 System Stuff/01.02 A Name/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_flat/files/00-09 System/01 System Stuff/01.02 A Name/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_flat/files/00-09 System/01 System Stuff/01.04 An ID/Other File: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_nested/jdex/00-09 System/01 System Stuff/01.4 Malformed Numbers.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/single_file_jdex/files/00-09 System/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/category_in_wrong_area/files/00-09 System/01 System Stuff/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/duplicate_area/files/00-09 A Reuse/02 Another Category/02.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/duplicate_category/files/00-09 System/01 A Reuse/01.02 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/id_in_wrong_category/files/00-09 System/01 System Stuff/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/id_in_wrong_category/files/00-09 System/01 System Stuff/11.01 Whoops/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/ignore_files/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [] 4 | } 5 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_category_name/files/00-09 System/01 System Stuff/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/nonempty_inbox/files/00-09 System/01 System Stuff/01.01 Inbox/Or This/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_flat/files/00-09 Systme/01 System Stuff/01.02 A Name/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_nested/files/00-09 Systme/01 System Stuff/01.00 An ID/Other File: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_nested/files/00-09 Systme/01 System Stuff/01.02 A Name/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_nested/files/00-09 System/01 System Stuf/01.00 An ID/Other File: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_nested/jdex/00-09 System/01 System Stuff/01.03 Another ID.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_index_suffix/files/00-09 System/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_index_suffix/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [] 4 | } 5 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_management_suffixes/files/00-09 System/01 System Stuff/01.02 A Name/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/id_different_from_jdex/files/00-09 System/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_category_in_wrong_area/files/00-09 System/01 System Stuff/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_category_flat/files/00-09 An Area/01 A Category/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_category_nested/files/00-09 An Area/01 A Category/01.00 An ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_area_name/files/00-09 System/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_flat/files/00-09 System/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_nested/files/00-09 System/01 System Stuff/01.02 A Name/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_flat/files/00-09 Systme/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_flat/files/00-09 System/01 System Stuf/01.02 A Name/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_nested/files/00-09 System/01 System Stuf/01.02 A Name/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_with_headers/files/10-19 Life Admin/10 Me, Myself, and I/10.02 An ID/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_with_headers/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [] 4 | } 5 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_management_suffixes/files/00-09 System/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_file_outside_category/files/00-09 System/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_category_name/files/00-09 System/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_nested/files/00-09 System/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/duplicate_area/files/00-09 An Area/01 A Category/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/duplicate_id/files/00-09 System/01 System Stuff/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/ignore_files/files/00-09 System/01 System Stuff/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/nonempty_inbox/files/00-09 System/01 System Stuff/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_nested/files/00-09 Systme/01 System Stuff/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_not_in_jdex/files/00-09 System/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_flat/files/00-09 System/01 System Stuf/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_nested/files/00-09 System/01 System Stuf/01.03 Another ID/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_duplicate_header/files/10-19 Life Admin/10 Me, Myself, and I/10.02 An ID/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_with_headers/files/00-09 System/01 Life Admin/01.03 Area Standard Zero/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_management_suffixes/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [] 4 | } 5 | -------------------------------------------------------------------------------- /tests/with_jdex/id_not_in_jdex/files/00-09 System/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_without_area/files/00-09 System/01 Life Admin/01.03 Area Standard Zero/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_without_area/files/10-19 Life Admin/10 Me, Myself, and I/10.02 An ID/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_id_flat/files/00-09 An Area/01 A Category/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_in_folders/files/00-09 System/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/single_file_jdex/files/00-09 System/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/duplicate_area/files/00-09 A Reuse/02 Another Category/02.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/duplicate_category/files/00-09 System/01 A Category/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/duplicate_category/files/00-09 System/01 A Reuse/01.02 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/file_outside_id/files/00-09 System/01 System Stuff/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_area_name/files/00-09 System/01 System Stuff/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_id_name/files/00-09 System/01 System Stuff/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_not_in_jdex/files/00-09 System/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros/files/00-09 System/01 Life Admin/01.03 Area Standard Zero/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_duplicate_header/files/00-09 System/01 Life Admin/01.03 Area Standard Zero/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_index_suffix/files/00-09 System/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/id_different_from_jdex/files/00-09 System/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_different_from_area/files/10-19 Life Admin/10 Me, Myself, and I/10.02 An ID/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_category_in_wrong_area/files/00-09 System/01 System Stuff/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_flat/files/00-09 An Area/01 A Category/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_header/files/10-19 An Area/10 A Category/10.02 An Id/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_nested/files/00-09 An Area/01 A Category/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_category_flat/files/00-09 An Area/01 A Category/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_id_nested/files/00-09 An Area/01 A Category/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_id_in_wrong_category/files/00-09 System/01 System Stuff/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_area_name/files/00-09 System/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/category_in_wrong_area/files/00-09 System/01 System Stuff/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/id_in_wrong_category/files/00-09 System/01 System Stuff/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_category_name/files/00-09 System/01 System Stuff/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_different_from_area/files/00-09 System/01 Life Admin/01.03 Area Standard Zero/File Inside ID: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_category_nested/files/00-09 An Area/01 A Category/01.00 An ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_file_outside_category/files/00-09 System/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_category_name/files/00-09 System/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_flat/files/00-09 System/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_nested/files/00-09 System/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_flat/files/00-09 Systme/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_nested/files/00-09 Systme/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_flat/files/00-09 System/01 System Stuf/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_with_management_suffixes/files/00-09 System/01 System Stuff/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_nested/files/00-09 System/01 System Stuf/01.03 Another ID/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_duplicate_header/files/00-09 System/01 Life Admin/01.03 Area Standard Zero/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_with_headers/files/00-09 System/01 Life Admin/01.03 Area Standard Zero/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_without_area/files/00-09 System/01 Life Admin/01.03 Area Standard Zero/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_different_from_area/files/00-09 System/01 Life Admin/01.03 Area Standard Zero/Directory Inside Id/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/with_jdex/single_file_jdex/jdex: -------------------------------------------------------------------------------- 1 | 00-09 System // which I can comment like this // and a nested one 2 | 01 System Stuff//Comments? 3 | // More comments 4 | 01.02 A Name 5 | - Location: work email. 6 | /* A 7 | block comment 8 | */ 9 | 10 | 11 | 12 | 01.03 Another ID // With a trailing comment 13 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | * [Changelog](#changelog) 4 | * [`v1.0.1`](#v101) 5 | * [`v1.0.0`](#v100) 6 | 7 | ## `v1.0.1` 8 | 9 | * 🚸 -- Group errors of the same type when printing, so the header and footer 10 | aren't unnecessarily repeated. This does not affect JSON output. 11 | 12 | ## `v1.0.0` 13 | 14 | Initial release. 15 | -------------------------------------------------------------------------------- /tests/with_jdex/area_not_in_jdex/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "AREA_NOT_IN_JDEX", 6 | "area": "1" 7 | }, 8 | "files": [ 9 | { 10 | "name": "10-19 Oops", 11 | "nested_under": [] 12 | } 13 | ] 14 | } 15 | ], 16 | "jdex_errors": [] 17 | } 18 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_without_area/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "type": "JDEX_AREA_HEADER_WITHOUT_AREA", 7 | "area": "2" 8 | }, 9 | "files": [ 10 | { 11 | "name": "20. Digital Stuff.md", 12 | "nested_under": [] 13 | } 14 | ] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_flat/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "AREA_DIFFERENT_FROM_JDEX", 6 | "area": "0", 7 | "jdex_name": "00-09 System" 8 | }, 9 | "files": [ 10 | { 11 | "name": "00-09 Systme", 12 | "nested_under": [] 13 | } 14 | ] 15 | } 16 | ], 17 | "jdex_errors": [] 18 | } 19 | -------------------------------------------------------------------------------- /tests/with_jdex/area_different_from_jdex_nested/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "AREA_DIFFERENT_FROM_JDEX", 6 | "area": "0", 7 | "jdex_name": "00-09 System" 8 | }, 9 | "files": [ 10 | { 11 | "name": "00-09 Systme", 12 | "nested_under": [] 13 | } 14 | ] 15 | } 16 | ], 17 | "jdex_errors": [] 18 | } 19 | -------------------------------------------------------------------------------- /tests/with_jdex/category_not_in_jdex/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "CATEGORY_NOT_IN_JDEX", 6 | "category": "01" 7 | }, 8 | "files": [ 9 | { 10 | "name": "01 System Stuff", 11 | "nested_under": [ 12 | "00-09 System" 13 | ] 14 | } 15 | ] 16 | } 17 | ], 18 | "jdex_errors": [] 19 | } 20 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_area_header_different_from_area/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "type": "JDEX_AREA_HEADER_DIFFERENT_FROM_AREA", 7 | "area": "1", 8 | "jdex_name": "10-19 Life Admin" 9 | }, 10 | "files": [ 11 | { 12 | "name": "10. Life Adminn.md", 13 | "nested_under": [] 14 | } 15 | ] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tests/with_jdex/id_not_in_jdex/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "ID_NOT_IN_JDEX", 6 | "id": "01.02" 7 | }, 8 | "files": [ 9 | { 10 | "name": "01.02 Missing ID", 11 | "nested_under": [ 12 | "00-09 System", 13 | "01 System Stuff" 14 | ] 15 | } 16 | ] 17 | } 18 | ], 19 | "jdex_errors": [] 20 | } 21 | -------------------------------------------------------------------------------- /tests/without_jdex/nonempty_inbox/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "NONEMPTY_INBOX", 6 | "num_items": 2 7 | }, 8 | "files": [ 9 | { 10 | "name": "01.01 Inbox", 11 | "nested_under": [ 12 | "00-09 System", 13 | "01 System Stuff" 14 | ] 15 | } 16 | ] 17 | } 18 | ], 19 | "jdex_errors": [] 20 | } 21 | -------------------------------------------------------------------------------- /tests/without_jdex/category_in_wrong_area/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "CATEGORY_IN_WRONG_AREA", 6 | "category_area": "1", 7 | "file_area": "0" 8 | }, 9 | "files": [ 10 | { 11 | "name": "11 Whoops", 12 | "nested_under": [ 13 | "00-09 System" 14 | ] 15 | } 16 | ] 17 | } 18 | ], 19 | "jdex_errors": [] 20 | } 21 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_category_in_wrong_area/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "type": "JDEX_CATEGORY_IN_WRONG_AREA", 7 | "category_area": "1", 8 | "file_area": "0" 9 | }, 10 | "files": [ 11 | { 12 | "name": "11 Whoops", 13 | "nested_under": [ 14 | "00-09 System" 15 | ] 16 | } 17 | ] 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /tests/without_jdex/duplicate_area/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "area": "0", 6 | "type": "DUPLICATE_AREA" 7 | }, 8 | "files": [ 9 | { 10 | "name": "00-09 A Reuse", 11 | "nested_under": [] 12 | }, 13 | { 14 | "name": "00-09 An Area", 15 | "nested_under": [] 16 | } 17 | ] 18 | } 19 | ], 20 | "jdex_errors": [] 21 | } 22 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_nested/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "area": "0", 7 | "type": "JDEX_DUPLICATE_AREA" 8 | }, 9 | "files": [ 10 | { 11 | "name": "00-09 A Reuse", 12 | "nested_under": [] 13 | }, 14 | { 15 | "name": "00-09 An Area", 16 | "nested_under": [] 17 | } 18 | ] 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_id_flat/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "id": "01.01", 7 | "type": "JDEX_DUPLICATE_ID" 8 | }, 9 | "files": [ 10 | { 11 | "name": "01.01 A Reuse.md", 12 | "nested_under": [] 13 | }, 14 | { 15 | "name": "01.01 An ID.md", 16 | "nested_under": [] 17 | } 18 | ] 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_flat/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "CATEGORY_DIFFERENT_FROM_JDEX", 6 | "category": "01", 7 | "jdex_name": "01 System Stuff" 8 | }, 9 | "files": [ 10 | { 11 | "name": "01 System Stuf", 12 | "nested_under": [ 13 | "00-09 System" 14 | ] 15 | } 16 | ] 17 | } 18 | ], 19 | "jdex_errors": [] 20 | } 21 | -------------------------------------------------------------------------------- /tests/with_jdex/category_different_from_jdex_nested/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "CATEGORY_DIFFERENT_FROM_JDEX", 6 | "category": "01", 7 | "jdex_name": "01 System Stuff" 8 | }, 9 | "files": [ 10 | { 11 | "name": "01 System Stuf", 12 | "nested_under": [ 13 | "00-09 System" 14 | ] 15 | } 16 | ] 17 | } 18 | ], 19 | "jdex_errors": [] 20 | } 21 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_header/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "area": "1", 7 | "type": "JDEX_DUPLICATE_AREA_HEADER" 8 | }, 9 | "files": [ 10 | { 11 | "name": "10. A Reuse.md", 12 | "nested_under": [] 13 | }, 14 | { 15 | "name": "10. An Area.md", 16 | "nested_under": [] 17 | } 18 | ] 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /tests/without_jdex/id_in_wrong_category/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "ID_IN_WRONG_CATEGORY", 6 | "id_ac": "11", 7 | "file_ac": "01" 8 | }, 9 | "files": [ 10 | { 11 | "name": "11.01 Whoops", 12 | "nested_under": [ 13 | "00-09 System", 14 | "01 System Stuff" 15 | ] 16 | } 17 | ] 18 | } 19 | ], 20 | "jdex_errors": [] 21 | } 22 | -------------------------------------------------------------------------------- /tests/with_jdex/flat_alt_zeros_duplicate_header/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "type": "JDEX_DUPLICATE_AREA_HEADER", 7 | "area": "1" 8 | }, 9 | "files": [ 10 | { 11 | "name": "10. Life Admin.md", 12 | "nested_under": [] 13 | }, 14 | { 15 | "name": "10. Life Adminn.md", 16 | "nested_under": [] 17 | } 18 | ] 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_id_in_wrong_category/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "type": "JDEX_ID_IN_WRONG_CATEGORY", 7 | "id_ac": "02", 8 | "file_ac": "01" 9 | }, 10 | "files": [ 11 | { 12 | "name": "02.00 Whoops.md", 13 | "nested_under": [ 14 | "00-09 System", 15 | "01 System Stuff" 16 | ] 17 | } 18 | ] 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_in_folders/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "ID_DIFFERENT_FROM_JDEX", 6 | "id": "01.02", 7 | "jdex_name": "01.02 A Name" 8 | }, 9 | "files": [ 10 | { 11 | "name": "01.02 A Naem", 12 | "nested_under": [ 13 | "00-09 System", 14 | "01 System Stuff" 15 | ] 16 | } 17 | ] 18 | } 19 | ], 20 | "jdex_errors": [] 21 | } 22 | -------------------------------------------------------------------------------- /tests/with_jdex/single_file_jdex/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "ID_DIFFERENT_FROM_JDEX", 6 | "id": "01.02", 7 | "jdex_name": "01.02 A Name" 8 | }, 9 | "files": [ 10 | { 11 | "name": "01.02 A Naem", 12 | "nested_under": [ 13 | "00-09 System", 14 | "01 System Stuff" 15 | ] 16 | } 17 | ] 18 | } 19 | ], 20 | "jdex_errors": [] 21 | } 22 | -------------------------------------------------------------------------------- /tests/with_jdex/id_different_from_jdex/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "ID_DIFFERENT_FROM_JDEX", 6 | "id": "01.02", 7 | "jdex_name": "01.02 A Name" 8 | }, 9 | "files": [ 10 | { 11 | "name": "01.02 A Naem", 12 | "nested_under": [ 13 | "00-09 System", 14 | "01 System Stuff" 15 | ] 16 | } 17 | ] 18 | } 19 | ], 20 | "jdex_errors": [] 21 | } 22 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_area_name/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "INVALID_AREA_NAME" 6 | }, 7 | "files": [ 8 | { 9 | "name": "10-18 Malformed", 10 | "nested_under": [] 11 | } 12 | ] 13 | }, 14 | { 15 | "error": { 16 | "type": "INVALID_AREA_NAME" 17 | }, 18 | "files": [ 19 | { 20 | "name": "No ID", 21 | "nested_under": [] 22 | } 23 | ] 24 | } 25 | ], 26 | "jdex_errors": [] 27 | } 28 | -------------------------------------------------------------------------------- /tests/without_jdex/duplicate_category/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "DUPLICATE_CATEGORY", 6 | "category": "01" 7 | }, 8 | "files": [ 9 | { 10 | "name": "01 A Category", 11 | "nested_under": [ 12 | "00-09 System" 13 | ] 14 | }, 15 | { 16 | "name": "01 A Reuse", 17 | "nested_under": [ 18 | "00-09 System" 19 | ] 20 | } 21 | ] 22 | } 23 | ], 24 | "jdex_errors": [] 25 | } 26 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_category_nested/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "category": "01", 7 | "type": "JDEX_DUPLICATE_CATEGORY" 8 | }, 9 | "files": [ 10 | { 11 | "name": "01 A Category", 12 | "nested_under": [ 13 | "00-09 An Area" 14 | ] 15 | }, 16 | { 17 | "name": "01 A Reuse", 18 | "nested_under": [ 19 | "00-09 An Area" 20 | ] 21 | } 22 | ] 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_area_name/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "type": "JDEX_INVALID_AREA_NAME" 7 | }, 8 | "files": [ 9 | { 10 | "name": "10-18 Malformed Numbers", 11 | "nested_under": [] 12 | } 13 | ] 14 | }, 15 | { 16 | "error": { 17 | "type": "JDEX_INVALID_AREA_NAME" 18 | }, 19 | "files": [ 20 | { 21 | "name": "No Numbers", 22 | "nested_under": [] 23 | } 24 | ] 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_flat/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "type": "JDEX_INVALID_ID_NAME" 7 | }, 8 | "files": [ 9 | { 10 | "name": "01.5 Malformed Numbers.md", 11 | "nested_under": [] 12 | } 13 | ] 14 | }, 15 | { 16 | "error": { 17 | "type": "JDEX_INVALID_ID_NAME" 18 | }, 19 | "files": [ 20 | { 21 | "name": "No Numbers.md", 22 | "nested_under": [] 23 | } 24 | ] 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /tests/without_jdex/duplicate_id/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "DUPLICATE_ID", 6 | "id": "01.00" 7 | }, 8 | "files": [ 9 | { 10 | "name": "01.00 A Reuse", 11 | "nested_under": [ 12 | "00-09 System", 13 | "01 System Stuff" 14 | ] 15 | }, 16 | { 17 | "name": "01.00 An ID", 18 | "nested_under": [ 19 | "00-09 System", 20 | "01 System Stuff" 21 | ] 22 | } 23 | ] 24 | } 25 | ], 26 | "jdex_errors": [] 27 | } 28 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_file_outside_category/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "type": "JDEX_FILE_OUTSIDE_CATEGORY" 7 | }, 8 | "files": [ 9 | { 10 | "name": "Not here", 11 | "nested_under": [] 12 | } 13 | ] 14 | }, 15 | { 16 | "error": { 17 | "type": "JDEX_FILE_OUTSIDE_CATEGORY" 18 | }, 19 | "files": [ 20 | { 21 | "name": "Nor here", 22 | "nested_under": [ 23 | "00-09 System" 24 | ] 25 | } 26 | ] 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_id_nested/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "id": "01.01", 7 | "type": "JDEX_DUPLICATE_ID" 8 | }, 9 | "files": [ 10 | { 11 | "name": "01.01 A Reuse.md", 12 | "nested_under": [ 13 | "00-09 An Area", 14 | "01 A Category" 15 | ] 16 | }, 17 | { 18 | "name": "01.01 An ID.md", 19 | "nested_under": [ 20 | "00-09 An Area", 21 | "01 A Category" 22 | ] 23 | } 24 | ] 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_category_name/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "INVALID_CATEGORY_NAME" 6 | }, 7 | "files": [ 8 | { 9 | "name": "2 Malformed", 10 | "nested_under": [ 11 | "00-09 System" 12 | ] 13 | } 14 | ] 15 | }, 16 | { 17 | "error": { 18 | "type": "INVALID_CATEGORY_NAME" 19 | }, 20 | "files": [ 21 | { 22 | "name": "No ID", 23 | "nested_under": [ 24 | "00-09 System" 25 | ] 26 | } 27 | ] 28 | } 29 | ], 30 | "jdex_errors": [] 31 | } 32 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_category_name/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "type": "JDEX_INVALID_CATEGORY_NAME" 7 | }, 8 | "files": [ 9 | { 10 | "name": "2 Malformed Numbers", 11 | "nested_under": [ 12 | "00-09 System" 13 | ] 14 | } 15 | ] 16 | }, 17 | { 18 | "error": { 19 | "type": "JDEX_INVALID_CATEGORY_NAME" 20 | }, 21 | "files": [ 22 | { 23 | "name": "No Numbers", 24 | "nested_under": [ 25 | "00-09 System" 26 | ] 27 | } 28 | ] 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /tests/without_jdex/invalid_id_name/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "INVALID_ID_NAME" 6 | }, 7 | "files": [ 8 | { 9 | "name": "01.1 Malformed", 10 | "nested_under": [ 11 | "00-09 System", 12 | "01 System Stuff" 13 | ] 14 | } 15 | ] 16 | }, 17 | { 18 | "error": { 19 | "type": "INVALID_ID_NAME" 20 | }, 21 | "files": [ 22 | { 23 | "name": "No ID", 24 | "nested_under": [ 25 | "00-09 System", 26 | "01 System Stuff" 27 | ] 28 | } 29 | ] 30 | } 31 | ], 32 | "jdex_errors": [] 33 | } 34 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_invalid_id_name_nested/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "type": "JDEX_INVALID_ID_NAME" 7 | }, 8 | "files": [ 9 | { 10 | "name": "01.4 Malformed Numbers.md", 11 | "nested_under": [ 12 | "00-09 System", 13 | "01 System Stuff" 14 | ] 15 | } 16 | ] 17 | }, 18 | { 19 | "error": { 20 | "type": "JDEX_INVALID_ID_NAME" 21 | }, 22 | "files": [ 23 | { 24 | "name": "No ID.md", 25 | "nested_under": [ 26 | "00-09 System", 27 | "01 System Stuff" 28 | ] 29 | } 30 | ] 31 | } 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_area_flat/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "area": "0", 7 | "type": "JDEX_DUPLICATE_AREA" 8 | }, 9 | "files": [ 10 | { 11 | "name": "00.00 A Reuse.md", 12 | "nested_under": [] 13 | }, 14 | { 15 | "name": "00.00 An Area.md", 16 | "nested_under": [] 17 | } 18 | ] 19 | }, 20 | { 21 | "error": { 22 | "id": "00.00", 23 | "type": "JDEX_DUPLICATE_ID" 24 | }, 25 | "files": [ 26 | { 27 | "name": "00.00 A Reuse.md", 28 | "nested_under": [] 29 | }, 30 | { 31 | "name": "00.00 An Area.md", 32 | "nested_under": [] 33 | } 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /tests/with_jdex/jdex_duplicate_category_flat/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [], 3 | "jdex_errors": [ 4 | { 5 | "error": { 6 | "category": "01", 7 | "type": "JDEX_DUPLICATE_CATEGORY" 8 | }, 9 | "files": [ 10 | { 11 | "name": "01.00 A Category.md", 12 | "nested_under": [] 13 | }, 14 | { 15 | "name": "01.00 A Reuse.md", 16 | "nested_under": [] 17 | } 18 | ] 19 | }, 20 | { 21 | "error": { 22 | "id": "01.00", 23 | "type": "JDEX_DUPLICATE_ID" 24 | }, 25 | "files": [ 26 | { 27 | "name": "01.00 A Category.md", 28 | "nested_under": [] 29 | }, 30 | { 31 | "name": "01.00 A Reuse.md", 32 | "nested_under": [] 33 | } 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /tests/without_jdex/file_outside_id/result.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "error": { 5 | "type": "FILE_OUTSIDE_ID" 6 | }, 7 | "files": [ 8 | { 9 | "name": "File Outside Area", 10 | "nested_under": [] 11 | } 12 | ] 13 | }, 14 | { 15 | "error": { 16 | "type": "FILE_OUTSIDE_ID" 17 | }, 18 | "files": [ 19 | { 20 | "name": "File Outside Category", 21 | "nested_under": [ 22 | "00-09 System" 23 | ] 24 | } 25 | ] 26 | }, 27 | { 28 | "error": { 29 | "type": "FILE_OUTSIDE_ID" 30 | }, 31 | "files": [ 32 | { 33 | "name": "File Outside Id", 34 | "nested_under": [ 35 | "00-09 System", 36 | "01 System Stuff" 37 | ] 38 | } 39 | ] 40 | } 41 | ], 42 | "jdex_errors": [] 43 | } 44 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | # Controls when the action will run. Triggers the workflow on push or pull request 4 | # events but only for the master branch 5 | on: [push, pull_request] 6 | 7 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 8 | jobs: 9 | test: 10 | # The type of runner that the job will run on 11 | runs-on: ${{ matrix.os }} 12 | 13 | strategy: 14 | matrix: 15 | os: [ubuntu-latest, macos-latest, windows-latest] 16 | python-version: ["3.10", "3.11", "3.12"] 17 | 18 | # Steps represent a sequence of tasks that will be executed as part of the job 19 | 20 | steps: 21 | - uses: actions/checkout@v4 22 | - name: Set up Python ${{ matrix.python-version }} 23 | uses: actions/setup-python@v5 24 | with: 25 | python-version: ${{ matrix.python-version }} 26 | # You can test your matrix by printing the current Python version 27 | - name: Display Python version 28 | run: python -c "import sys; print(sys.version)" 29 | 30 | - name: Run tests 31 | run: ./run_tests.py 32 | -------------------------------------------------------------------------------- /run_tests.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | """Tests for jdlint.""" 4 | 5 | from __future__ import annotations 6 | 7 | import dataclasses 8 | import json 9 | import os 10 | import unittest 11 | from pathlib import Path, PurePath 12 | from typing import Any 13 | 14 | import jdlint 15 | 16 | 17 | def _convert_err(e: jdlint.Error | jdlint.JDexError) -> dict[str, Any]: 18 | return { 19 | "error": dataclasses.asdict(e.error) # type: ignore[arg-type] 20 | if dataclasses.is_dataclass(e.error) 21 | else e.error, 22 | "files": [ 23 | # Strip full_path, since it's dependent on where we're running the test 24 | {"name": f.name, "nested_under": f.nested_under} 25 | for f in e.files 26 | ], 27 | } 28 | 29 | 30 | class AllTests(unittest.TestCase): 31 | """Locate and run all tests.""" 32 | 33 | def tests_without_jdex(self) -> None: 34 | """Locate and run tests that don't require the jdex.""" 35 | self.maxDiff = None # Show full diff 36 | 37 | # Find all tests 38 | with os.scandir(PurePath("tests", "without_jdex")) as test_it: 39 | for f in test_it: 40 | # Make a subtest and open result file 41 | with self.subTest(msg=f.name, f=f), Path( 42 | f, 43 | "result.json", 44 | ).open() as golden_file: 45 | # Get ignore file if any 46 | try: 47 | ignore = Path(f, "ignore").read_text().splitlines() 48 | except FileNotFoundError: 49 | ignore = [] 50 | 51 | # Lint the test dir 52 | results = jdlint.lint_dir( 53 | Path(f, "files"), 54 | ignored=ignore, 55 | ) 56 | expected = json.load(golden_file) 57 | 58 | # Convert lint results into loaded format 59 | actual = { 60 | "errors": [_convert_err(e) for e in results.errors], 61 | "jdex_errors": [], 62 | } 63 | 64 | # Compare results 65 | self.assertEqual(expected, actual) # noqa: PT009 66 | 67 | def tests_with_jdex(self) -> None: 68 | """Locate and run tests that have the JDex.""" 69 | self.maxDiff = None # Show full diff 70 | 71 | # Find all tests 72 | with os.scandir(PurePath("tests", "with_jdex")) as test_it: 73 | for f in test_it: 74 | # Make a subtest and open result file 75 | with self.subTest(msg=f.name, f=f), Path( 76 | f, 77 | "result.json", 78 | ).open() as golden_file: 79 | # Get ignore file if any 80 | try: 81 | ignore = Path(f, "ignore").read_text().splitlines() 82 | except FileNotFoundError: 83 | ignore = [] 84 | 85 | # Lint the test dir and JDex 86 | (errors, jdex_errors) = jdlint.lint_dir_and_jdex( 87 | path=Path(f, "files"), 88 | jdex_path=Path(f, "jdex"), 89 | ignored=ignore, 90 | alt_zeros=Path(f, "altzeros").exists(), 91 | ) 92 | expected = json.load(golden_file) 93 | 94 | # Convert lint results into loaded format 95 | actual = { 96 | "errors": [_convert_err(e) for e in errors], 97 | "jdex_errors": [_convert_err(e) for e in jdex_errors], 98 | } 99 | 100 | # Compare results 101 | self.assertEqual(expected, actual) # noqa: PT009 102 | 103 | 104 | if __name__ == "__main__": 105 | unittest.main() 106 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jdlint [23.10] 2 | 3 | Ensure that your [Johnny Decimal](https://johnnydecimal.com/) system is neat and 4 | clean. 5 | 6 | * [jdlint](#jdlint) 7 | * [Installation/Requirements](#installationrequirements) 8 | * [Usage](#usage) 9 | * [With a JDex/Index](#with-a-jdexindex) 10 | * [JDex Formats](#jdex-formats) 11 | * [Alternative Layout for the Standard Zeros](#alternative-layout-for-the-standard-zeros) 12 | * [Ignoring Files](#ignoring-files) 13 | * [Disabling Specific Rules](#disabling-specific-rules) 14 | * [I Am A Robot And Want Something Machine-Readable](#i-am-a-robot-and-want-something-machine-readable) 15 | * [File Errors](#file-errors) 16 | * [`AREA_DIFFERENT_FROM_JDEX`](#area_different_from_jdex) 17 | * [`AREA_NOT_IN_JDEX`](#area_not_in_jdex) 18 | * [`CATEGORY_DIFFERENT_FROM_JDEX`](#category_different_from_jdex) 19 | * [`CATEGORY_IN_WRONG_AREA`](#category_in_wrong_area) 20 | * [`CATEGORY_NOT_IN_JDEX`](#category_not_in_jdex) 21 | * [`DUPLICATE_AREA`](#duplicate_area) 22 | * [`DUPLICATE_CATEGORY`](#duplicate_category) 23 | * [`DUPLICATE_ID`](#duplicate_id) 24 | * [`FILE_OUTSIDE_ID`](#file_outside_id) 25 | * [`ID_DIFFERENT_FROM_JDEX`](#id_different_from_jdex) 26 | * [`ID_IN_WRONG_CATEGORY`](#id_in_wrong_category) 27 | * [`ID_NOT_IN_JDEX`](#id_not_in_jdex) 28 | * [`INVALID_AREA_NAME`](#invalid_area_name) 29 | * [`INVALID_CATEGORY_NAME`](#invalid_category_name) 30 | * [`INVALID_ID_NAME`](#invalid_id_name) 31 | * [`NONEMPTY_INBOX`](#nonempty_inbox) 32 | * [JDex Errors](#jdex-errors) 33 | * [`JDEX_AREA_HEADER_DIFFERENT_FROM_AREA`](#jdex_area_header_different_from_area) 34 | * [`JDEX_AREA_HEADER_WITHOUT_AREA`](#jdex_area_header_without_area) 35 | * [`JDEX_CATEGORY_IN_WRONG_AREA`](#jdex_category_in_wrong_area) 36 | * [`JDEX_DUPLICATE_AREA`](#jdex_duplicate_area) 37 | * [`JDEX_DUPLICATE_AREA_HEADER`](#jdex_duplicate_area_header) 38 | * [`JDEX_DUPLICATE_CATEGORY`](#jdex_duplicate_category) 39 | * [`JDEX_DUPLICATE_ID`](#jdex_duplicate_id) 40 | * [`JDEX_FILE_OUTSIDE_CATEGORY`](#jdex_file_outside_category) 41 | * [`JDEX_ID_IN_WRONG_CATEGORY`](#jdex_id_in_wrong_category) 42 | * [`JDEX_INVALID_AREA_NAME`](#jdex_invalid_area_name) 43 | * [`JDEX_INVALID_CATEGORY_NAME`](#jdex_invalid_category_name) 44 | * [`JDEX_INVALID_ID_NAME`](#jdex_invalid_id_name) 45 | * [Why Doesn't This Check For-](#why-doesnt-this-check-for-) 46 | * [Acknowledgements](#acknowledgements) 47 | 48 | ## Installation/Requirements 49 | 50 | Install a fairly recent version of 51 | [Python 3](https://www.python.org/downloads/); `jdlint` is tested to work on 52 | Python 3.10 and up. Python 3.9 and earlier is not supported. 53 | 54 | That's it! There are no other dependencies. 55 | 56 | `jdlint` should work on Linux, OS X, or Windows. 57 | 58 | ## Usage 59 | 60 | The script itself is executable (you should be able to just run `./jdlint.py`), 61 | or you can explicitly point python at it, like `python3 jdlint.py`. 62 | 63 | You'll need to pass the script the root folder of your JD-organized file system, 64 | e.g. 65 | 66 | ```bash 67 | ./jdlint.py ~/Documents 68 | ``` 69 | 70 | ### With a JDex/Index 71 | 72 | If you have your JDex/Index stored as files, you can improve the number of 73 | detected issues by passing that root path along as well, e.g. 74 | 75 | ```bash 76 | ./jdlint.py --jdex ~/"Knowledge/00.00 📇 System Index" ~/Documents 77 | ``` 78 | 79 | #### JDex Formats 80 | 81 | This supports three possible JDex formats: 82 | 83 | * Single file, as specified [here](https://github.com/johnnydecimal/index-spec). 84 | Note that strict adherence to the spec is not checked, because I personally do 85 | not use this method and am lazy, so don't expect linter errors for your JDex 86 | if you use this format. 87 | * Nested files in folders, e.g. 88 | 89 | ```text 90 | . 91 | └── 00-09 System 92 | └── 01 System Stuff 93 | ├── 01.02 A Name.md 94 | └── 01.03 Another ID.md 95 | ``` 96 | 97 | * Flat files, e.g. 98 | 99 | ```tree 100 | . 101 | ├── 00.00 System Area Management.md 102 | ├── 01.00 System Stuff Category Management.md 103 | ├── 01.02 A Name.md 104 | └── 01.03 Another ID.md 105 | ``` 106 | 107 | Note that in the flat case, `N0.00` is taken as the JDex entry for area `N0-N9`, 108 | and `AC.00` is taken as the JDex entry for category `AC`. 109 | 110 | In all cases, any `.md` file extension will be stripped, should one exist. 111 | 112 | A trailing `area management` or `category management` or `index` will also be 113 | stripped, if one exists, to derive the "canonical" name for the area/category. 114 | 115 | For example: 116 | 117 | * `10.00 Life Admin` 118 | * `10.00 Life Admin.md` 119 | * `10.00 Life Admin Area Management` 120 | * `10.00 Life Admin Index` 121 | * `10.00 Life Admin Area Management Index.md` 122 | 123 | are all equivalent, and will lead to `jdlint` expecting an area named 124 | `10-19 Life Admin` in your files. 125 | 126 | #### Alternative Layout for the Standard Zeros 127 | 128 | For a more complete treatment of this topic, see the original post 129 | [here](https://forum.johnnydecimal.com/t/the-standard-zeros/1558/12). 130 | 131 | This moves the expected area management zeros into the system management area. 132 | For example, the management category for area `10-19` will be category `01`, 133 | instead of the typical `10`. This increases the available number of categories 134 | per area and makes greater use of the reserved `00-09` area. 135 | 136 | To specify that you're using this format, pass `jdlint` the `--altzeros` flag. 137 | 138 | This causes two changes in behavior if you are using the flat files JDex 139 | structure: 140 | 141 | * The linter will treat `10.00` as the note for category `10`, and `01.00` as 142 | the note for area `10-19`, etc. 143 | * The area management notes (`0N.00`) will additionally create categories in the 144 | `00-09` area, for those standard zeros. 145 | * The linter will check for optional "header" files. This is not an official 146 | Johnny Decimal thing, just something I use to visually separate notes in the 147 | JDex. They are named e.g. `10. Life Admin` for the `10-19 Life Admin` area. 148 | 149 | ![An image showing how `40. Improvement` nicely shows `20.00 Education` as nested under it.](images/header_note.png) 150 | 151 | If you don't use them, there will be no complaints from the linter; it just 152 | ensures their names stay in sync with the area if they do already exist. 153 | 154 | ### Ignoring Files 155 | 156 | You may have files outside of IDs that have to be there; if so, you can ignore 157 | them, e.g. 158 | 159 | ```bash 160 | ./jdlint.py ~/Documents --ignore .st* 161 | ``` 162 | 163 | This option supports some basic glob-style patterns. (It uses 164 | [`PurePath.match()`](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.match).) 165 | 166 | ### Disabling Specific Rules 167 | 168 | Maybe you disagree with a specific issue detected by this linter or have reason 169 | to break the rules. If so, you can disable a rule, e.g. 170 | 171 | ```bash 172 | ./jdlint.py ~/Documents --disable NONEMPTY_INBOX 173 | ``` 174 | 175 | ### I Am A Robot And Want Something Machine-Readable 176 | 177 | Ask nicely for JSON output instead! 178 | 179 | ```bash 180 | ./jdlint.py ~/Documents --json 181 | ``` 182 | 183 | ## File Errors 184 | 185 | These are errors that can be generated for your files. Some of them require you 186 | passing your JDex via the `--jdex` argument to be detected. 187 | 188 | ### `AREA_DIFFERENT_FROM_JDEX` 189 | 190 | An area with a differently-named JDex entry, e.g. 191 | 192 | ```text 193 | . 194 | ├── files 195 | │   └── 00-09 Systme <-- This is a typo, oops! 196 | │   └── 01 System Stuff 197 | │   ├── 01.00 An ID 198 | │   ├── 01.02 A Name 199 | │   └── 01.03 Another ID 200 | └── jdex 201 |   └── 00-09 System 202 |    └── 01 System Stuff 203 |    ├── 01.00 An ID.md 204 |    ├── 01.02 A Name.md 205 |    └── 01.03 Another ID.md 206 | ``` 207 | 208 | ### `AREA_NOT_IN_JDEX` 209 | 210 | An area without a corresponding JDex entry, e.g. 211 | 212 | ```text 213 | . 214 | ├── files 215 | │   ├── 00-09 System 216 | │   │   └── 01 System Stuff 217 | │   │   ├── 01.02 A Name 218 | │   │   └── 01.03 Another ID 219 | │   └── 10-19 Oops <-- This area has no corresponding entry in the JDex/index 220 | │   └── 11 Cat 221 | │   └── 11.12 ID 222 | └──jdex 223 |    ├── 00.00 System.md 224 |    ├── 01.00 System Stuff.md 225 |    ├── 01.02 A Name.md 226 |    ├── 01.03 Another ID.md 227 |    ├── 11.00 Cat.md 228 |    └── 11.12 ID.md 229 | ``` 230 | 231 | ### `CATEGORY_DIFFERENT_FROM_JDEX` 232 | 233 | A category with a differently-named JDex entry, e.g. 234 | 235 | ```text 236 | . 237 | ├── files 238 | │   └── 00-09 System 239 | │   └── 01 System Stuf <-- This is a typo, oops! 240 | │   ├── 01.00 An ID 241 | │   │   └── Other File 242 | │   ├── 01.02 A Name 243 | │   └── 01.03 Another ID 244 | └── jdex 245 |   └── 00-09 System 246 |    └── 01 System Stuff 247 |    ├── 01.00 An ID.md 248 |    ├── 01.02 A Name.md 249 |    └── 01.03 Another ID.md 250 | ``` 251 | 252 | ### `CATEGORY_IN_WRONG_AREA` 253 | 254 | A category that, by its number, has been put in the wrong area, e.g. 255 | 256 | ```text 257 | . 258 | └── 00-09 System 259 | ├── 01 System Stuff 260 | │   └── 01.00 An ID 261 | └── 11 Whoops <-- This is in the wrong area 262 | └── 11.01 Inbox 263 | ``` 264 | 265 | ### `CATEGORY_NOT_IN_JDEX` 266 | 267 | A category without a corresponding JDex entry, e.g. 268 | 269 | ```text 270 | . 271 | ├── files 272 | │   └── 00-09 System 273 | │   └── 01 System Stuff <-- This category has no corresponding entry in the JDex 274 | │   ├── 01.02 An ID 275 | │   └── 01.03 Another ID 276 | └── jdex 277 |    ├── 00.00 System.md 278 |    ├── 01.00 An ID.md 279 |    └── 01.03 Another ID.md 280 | ``` 281 | 282 | ### `DUPLICATE_AREA` 283 | 284 | An area that has been used multiple times, e.g. 285 | 286 | ```text 287 | . 288 | ├── 00-09 An Area <-- 00-09 has been used twice! 289 | │   └── 01 A Category 290 | │   └── 01.00 An ID 291 | └── 00-09 A Reuse <-- 00-09 has been used twice! 292 | └── 02 Another Category 293 | └── 02.00 An ID 294 | ``` 295 | 296 | ### `DUPLICATE_CATEGORY` 297 | 298 | A category that has been used multiple times, e.g. 299 | 300 | ```text 301 | . 302 | └── 00-09 System 303 | ├── 01 A Category <-- 01 has been used twice! 304 | │   └── 01.00 An ID 305 | └── 01 A Reuse <-- 01 has been used twice! 306 | └── 01.02 Another ID 307 | ``` 308 | 309 | ### `DUPLICATE_ID` 310 | 311 | An ID that has been used multiple times, e.g. 312 | 313 | ```text 314 | . 315 | └── 00-09 System 316 | └── 01 System Stuff 317 | ├── 01.11 An ID <-- 01.11 has been used twice! 318 | └── 01.11 A Reuse <-- 01.11 has been used twice! 319 | ``` 320 | 321 | ### `FILE_OUTSIDE_ID` 322 | 323 | A file that is located somewhere higher up than in an ID folder, e.g. 324 | 325 | ```text 326 | . 327 | ├── 00-09 System 328 | │   ├── 01 System Stuff 329 | │   │   ├── 01.00 An ID 330 | │   │   └── File Outside Id <-- 331 | │   └── File Outside Category <-- All of these should only be in IDs 332 | └── File Outside Area <-- 333 | ``` 334 | 335 | Use the `--ignore FILE_NAME` option if you have files that *have* to be there, 336 | e.g. `.stignore` is you use Syncthing. 337 | 338 | ### `ID_DIFFERENT_FROM_JDEX` 339 | 340 | An ID with a differently-named JDex entry, e.g. 341 | 342 | ```text 343 | ├── files 344 | │   └── 00-09 System 345 | │   └── 01 System Stuff 346 | │   ├── 01.02 A Naem <-- This is a typo, oops! 347 | │   ├── 01.03 Another ID 348 | │   └── 01.04 An ID 349 | └── jdex 350 |    ├── 00.00 System.md 351 |    ├── 01.00 System Stuff.md 352 |    ├── 01.02 A Name.md 353 |    ├── 01.03 Another ID.md 354 |    └── 01.04 An ID.md 355 | ``` 356 | 357 | ### `ID_IN_WRONG_CATEGORY` 358 | 359 | An ID that, by its number, has been put in the wrong category, e.g. 360 | 361 | ```text 362 | . 363 | └── 00-09 System 364 | └── 01 System Stuff 365 | ├── 01.00 An ID 366 | └── 11.01 Whoops <-- This is in the wrong category 367 | ``` 368 | 369 | ### `ID_NOT_IN_JDEX` 370 | 371 | An ID without a corresponding JDex entry, e.g. 372 | 373 | ```text 374 | . 375 | ├── files 376 | │   └── 00-09 System 377 | │   └── 01 System Stuff 378 | │   ├── 01.00 An ID 379 | │   ├── 01.02 Missing ID <-- This ID has no corresponding entry in the JDex/index 380 | │   └── 01.03 Another ID 381 | └── jdex 382 |    ├── 01.00 An ID.md 383 |    └── 01.03 Another ID.md 384 | ``` 385 | 386 | ### `INVALID_AREA_NAME` 387 | 388 | A directory was found at the area level that doesn't begin with `00-09` or the 389 | like, e.g. 390 | 391 | ```text 392 | . 393 | ├── 00-09 System 394 | │   └── 01 System Stuff 395 | │   └── 01.00 An ID 396 | ├── 10-18 Malformed <-- This has numbers that were typo'd. 397 | └── No ID <-- This doesn't have numbers at all 398 | ``` 399 | 400 | ### `INVALID_CATEGORY_NAME` 401 | 402 | A directory was found at the category level that doesn't begin with `11` or the 403 | like, e.g. 404 | 405 | ```text 406 | . 407 | └── 00-09 System 408 | ├── 01 System Stuff 409 | │   └── 01.00 An ID 410 | ├── 2 Malformed <-- This has numbers that were typo'd. 411 | └── No ID <-- This doesn't have numbers at all 412 | ``` 413 | 414 | ### `INVALID_ID_NAME` 415 | 416 | A directory was found at the ID level that doesn't begin with `11.12` or the 417 | like, e.g. 418 | 419 | ```text 420 | . 421 | └── 00-09 System 422 | └── 01 System Stuff 423 | ├── 01.00 An ID 424 | ├── 01.1 Malformed <-- This has numbers that were typo'd. 425 | └── No ID <-- This doesn't have numbers at all 426 | ``` 427 | 428 | ### `NONEMPTY_INBOX` 429 | 430 | An inbox (AC.01) that contains items, e.g. 431 | 432 | ```text 433 | . 434 | └── 01 System Stuff 435 | ├── 01.01 Inbox 436 | │ └── This is something you meant to sort that you never got around to... 437 | └── 01.11 An ID 438 | ``` 439 | 440 | ## JDex Errors 441 | 442 | These are errors that are only generated with the `--jdex` argument and concern 443 | the state of your JDex, not your organized files. 444 | 445 | ### `JDEX_AREA_HEADER_DIFFERENT_FROM_AREA` 446 | 447 | An (optional) area header with a differently-named JDex entry, e.g. 448 | 449 | ```text 450 | jdex 451 | ├── 00.00 System Area Management.md 452 | ├── 01.00 Life Admin Area Management.md 453 | ├── 01.03 Area Standard Zero.md 454 | ├── 10. Life Adminn.md <-- This is a typo, oops! 455 | ├── 10.00 Me, Myself, and I.md 456 | └── 10.02 An ID.md 457 | ``` 458 | 459 | ### `JDEX_AREA_HEADER_WITHOUT_AREA` 460 | 461 | An (optional) area header without any corresponding JDex entry, e.g. 462 | 463 | ```text 464 | jdex 465 | ├── 00.00 System Area Management.md 466 | ├── 01.00 Life Admin Area Management.md 467 | ├── 01.03 Area Standard Zero.md 468 | ├── 10. Life Admin.md 469 | ├── 10.00 Me, Myself, and I.md 470 | ├── 10.02 An ID.md 471 | └── 20. Digital Stuff.md <- There is no corresponding area 472 | ``` 473 | 474 | ### `JDEX_CATEGORY_IN_WRONG_AREA` 475 | 476 | A JDex category that, by its number, has been put in the wrong area, e.g. 477 | 478 | ```text 479 | jdex 480 | └── 00-09 System 481 | ├── 01 System Stuff 482 | │   └── 01.00 An ID 483 | └── 11 Whoops <-- This is in the wrong area 484 | └── 11.01 Inbox 485 | ``` 486 | 487 | ### `JDEX_DUPLICATE_AREA` 488 | 489 | A JDex area that has been used multiple times, e.g. 490 | 491 | ```text 492 | jdex 493 | ├── 00-09 An Area <-- 00-09 has been used twice! 494 | │   └── 01 A Category 495 | │   └── 01.00 An ID 496 | └── 00-09 A Reuse <-- 00-09 has been used twice! 497 | └── 02 Another Category 498 | └── 02.00 An ID 499 | ``` 500 | 501 | ### `JDEX_DUPLICATE_AREA_HEADER` 502 | 503 | An (optional) area header that has been used multiple times, e.g. 504 | 505 | ```text 506 | jdex 507 | ├── 00.00 System Area Management.md 508 | ├── 01.00 An Area.md 509 | ├── 01.03 Area Standard Zero.md 510 | ├── 10. An Area.md <-- These are both for 10-19 511 | ├── 10. A Reuse.md <-- These are both for 10-19 512 | ├── 10.00 Me, Myself, and I.md 513 | └── 10.02 An ID.md 514 | ``` 515 | 516 | ### `JDEX_DUPLICATE_CATEGORY` 517 | 518 | A JDex category that has been used multiple times, e.g. 519 | 520 | ```text 521 | jdex 522 | └── 00-09 System 523 | ├── 01 A Category <-- 01 has been used twice! 524 | │   └── 01.00 An ID 525 | └── 01 A Reuse <-- 01 has been used twice! 526 | └── 01.02 Another ID 527 | ``` 528 | 529 | ### `JDEX_DUPLICATE_ID` 530 | 531 | A JDex ID that has been used multiple times, e.g. 532 | 533 | ```text 534 | jdex 535 | └── 00-09 System 536 | └── 01 System Stuff 537 | ├── 01.11 An ID <-- 01.11 has been used twice! 538 | └── 01.11 A Reuse <-- 01.11 has been used twice! 539 | ``` 540 | 541 | ### `JDEX_FILE_OUTSIDE_CATEGORY` 542 | 543 | A file that is located at the area or category level in a nested JDex, e.g. 544 | 545 | ```text 546 | jdex 547 | ├── 00-09 System 548 | │   ├── 01 System Stuff 549 | │   │   ├── 01.02 A Name.md 550 | │   │   └── 01.03 Another ID.md 551 | │   └── Nor here <-- Both of these should only be in categories 552 | └── Not here <-- 553 | ``` 554 | 555 | ### `JDEX_ID_IN_WRONG_CATEGORY` 556 | 557 | A JDex ID that, by its number, has been put in the wrong category in a nested 558 | structure, e.g. 559 | 560 | ```text 561 | jdex 562 | └── 00-09 System 563 | └── 01 System Stuff 564 | ├── 01.00 An ID 565 | └── 02.01 Whoops <-- This is in the wrong category 566 | ``` 567 | 568 | ### `JDEX_INVALID_AREA_NAME` 569 | 570 | A directory was found at the area level in the JDex that doesn't begin with 571 | `00-09` or the like, e.g. 572 | 573 | ```text 574 | jdex 575 | ├── 00-09 System 576 | │   └── 01 System Stuff 577 | │   └── 01.02 An ID 578 | ├── 10-18 Malformed <-- This has numbers that were typo'd. 579 | └── No ID <-- This doesn't have numbers at all 580 | ``` 581 | 582 | ### `JDEX_INVALID_CATEGORY_NAME` 583 | 584 | A directory was found at the category level in the JDex that doesn't begin with 585 | `11` or the like, e.g. 586 | 587 | ```text 588 | jdex 589 | └── 00-09 System 590 | ├── 01 System Stuff 591 | │   └── 01.02 An ID 592 | ├── 2 Malformed <-- This has numbers that were typo'd. 593 | └── No ID <-- This doesn't have numbers at all 594 | ``` 595 | 596 | ### `JDEX_INVALID_ID_NAME` 597 | 598 | A JDEx note was found at the ID level that doesn't begin with `11.12` or the 599 | like, e.g. 600 | 601 | ```text 602 | . 603 | └── 00-09 System 604 | └── 01 System Stuff 605 | ├── 01.00 An ID 606 | ├── 01.1 Malformed <-- This has numbers that were typo'd. 607 | └── No ID <-- This doesn't have numbers at all 608 | ``` 609 | 610 | ## Why Doesn't This Check For- 611 | 612 | Because I didn't think of it. Open an issue and maybe it will get added! 613 | 614 | ## Acknowledgements 615 | 616 | This project has no formal affiliation with the Johnny Decimal system. The 617 | license for said system may be found 618 | [here](https://johnnydecimal.com/00-09-site-administration/01-about/01.02-licence/). 619 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /jdlint.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | """Script to check for common issues with a Johnny Decimal system.""" 4 | 5 | from __future__ import annotations 6 | 7 | import argparse 8 | import dataclasses 9 | import json 10 | import os 11 | import re 12 | import sys 13 | from dataclasses import dataclass 14 | from pathlib import Path, PurePath 15 | from typing import Any, Callable, Literal, TypeVar 16 | 17 | 18 | @dataclass(frozen=True) 19 | class AreaDifferentFromJDex: 20 | """An area with a differently-named JDex entry.""" 21 | 22 | area: str 23 | jdex_name: str 24 | type: Literal["AREA_DIFFERENT_FROM_JDEX"] = "AREA_DIFFERENT_FROM_JDEX" 25 | 26 | def display(self, files: list[File]) -> str: 27 | """Display this particular instance of an error.""" 28 | return f"{_print_nest(files[0])} [JDex name: {self.jdex_name}]" 29 | 30 | def explain(self) -> _Explanation: 31 | """Explain what this error is.""" 32 | return _Explanation( 33 | explanation="An area was found, the name of which is different from its corresponding JDex entry.", 34 | fix="Update the one that is incorrect.", 35 | ) 36 | 37 | 38 | @dataclass(frozen=True) 39 | class AreaNotInJDex: 40 | """An area without a corresponding JDex entry.""" 41 | 42 | area: str 43 | type: Literal["AREA_NOT_IN_JDEX"] = "AREA_NOT_IN_JDEX" 44 | 45 | def display(self, files: list[File]) -> str: 46 | """Display this particular instance of an error.""" 47 | return f"{_print_nest(files[0])} [area: {_print_area(self.area)}]" 48 | 49 | def explain(self) -> _Explanation: 50 | """Explain what this error is.""" 51 | return _Explanation( 52 | explanation="An area was found in your files that is missing from your JDex.", 53 | fix="Go add a corresponding entry to your JDex, or delete this if it's unused.", 54 | ) 55 | 56 | 57 | @dataclass(frozen=True) 58 | class CategoryDifferentFromJDex: 59 | """A category with a differently-named JDex entry.""" 60 | 61 | category: str 62 | jdex_name: str 63 | type: Literal["CATEGORY_DIFFERENT_FROM_JDEX"] = "CATEGORY_DIFFERENT_FROM_JDEX" 64 | 65 | def display(self, files: list[File]) -> str: 66 | """Display this particular instance of an error.""" 67 | return f"{_print_nest(files[0])} [JDex name: {self.jdex_name}]" 68 | 69 | def explain(self) -> _Explanation: 70 | """Explain what this error is.""" 71 | return _Explanation( 72 | explanation="A category was found, the name of which is different from its corresponding JDex entry.", 73 | fix="Update the one that is incorrect.", 74 | ) 75 | 76 | 77 | @dataclass(frozen=True) 78 | class CategoryInWrongArea: 79 | """A category that, by its number, has been put in the wrong area.""" 80 | 81 | category_area: str 82 | file_area: str 83 | type: Literal["CATEGORY_IN_WRONG_AREA"] = "CATEGORY_IN_WRONG_AREA" 84 | 85 | def display(self, files: list[File]) -> str: 86 | """Given the file's name, print the error message for it.""" 87 | return f"{_print_nest(files[0])} [in {_print_area(self.file_area)} but should be in {_print_area(self.category_area)}]" 88 | 89 | def explain(self) -> _Explanation: 90 | """Explain what this error is.""" 91 | return _Explanation( 92 | explanation="Some categories are in the wrong area.", 93 | fix="Move them into the correct area folder.", 94 | ) 95 | 96 | 97 | @dataclass(frozen=True) 98 | class CategoryNotInJDex: 99 | """An category without a corresponding JDex entry.""" 100 | 101 | category: str 102 | type: Literal["CATEGORY_NOT_IN_JDEX"] = "CATEGORY_NOT_IN_JDEX" 103 | 104 | def display(self, files: list[File]) -> str: 105 | """Display this particular instance of an error.""" 106 | return f"{_print_nest(files[0])} [category: {self.category}]" 107 | 108 | def explain(self) -> _Explanation: 109 | """Explain what this error is.""" 110 | return _Explanation( 111 | explanation="A category was found in the files that is missing from the JDex.", 112 | fix="Go add a corresponding entry to your JDex.", 113 | ) 114 | 115 | 116 | @dataclass(frozen=True) 117 | class DuplicateArea: 118 | """An area that has been used multiple times.""" 119 | 120 | area: str 121 | type: Literal["DUPLICATE_AREA"] = "DUPLICATE_AREA" 122 | 123 | def display(self, files: list[File]) -> str: 124 | """Display this particular instance of an error.""" 125 | return f"Area {_print_area(self.area)}:\n " + "\n ".join( 126 | [_print_nest(f) for f in files], 127 | ) 128 | 129 | def explain(self) -> _Explanation: 130 | """Explain what this error is.""" 131 | return _Explanation( 132 | explanation="Duplicate areas were used.", 133 | fix="Assign a new area to one of them.", 134 | ) 135 | 136 | 137 | @dataclass(frozen=True) 138 | class DuplicateCategory: 139 | """A category that has been used multiple times.""" 140 | 141 | category: str 142 | type: Literal["DUPLICATE_CATEGORY"] = "DUPLICATE_CATEGORY" 143 | 144 | def display(self, files: list[File]) -> str: 145 | """Display this particular instance of an error.""" 146 | return f"Category {self.category}:\n " + "\n ".join( 147 | [_print_nest(f) for f in files], 148 | ) 149 | 150 | def explain(self) -> _Explanation: 151 | """Explain what this error is.""" 152 | return _Explanation( 153 | explanation="Duplicate categories were used.", 154 | fix="Assign a new category to one of them.", 155 | ) 156 | 157 | 158 | @dataclass(frozen=True) 159 | class DuplicateId: 160 | """An ID that has been used multiple times.""" 161 | 162 | id: str 163 | type: Literal["DUPLICATE_ID"] = "DUPLICATE_ID" 164 | 165 | def display(self, files: list[File]) -> str: 166 | """Display this particular instance of an error.""" 167 | return f"ID {self.id}:\n " + "\n ".join([_print_nest(f) for f in files]) 168 | 169 | def explain(self) -> _Explanation: 170 | """Explain what this error is.""" 171 | return _Explanation( 172 | explanation="Duplicate IDs were used.", 173 | fix="Assign a new ID to one of them.", 174 | ) 175 | 176 | 177 | @dataclass(frozen=True) 178 | class FileOutsideId: 179 | """A file was encountered not in a terminal ID folder.""" 180 | 181 | type: Literal["FILE_OUTSIDE_ID"] = "FILE_OUTSIDE_ID" 182 | 183 | def display(self, files: list[File]) -> str: 184 | """Display this particular instance of an error.""" 185 | return _print_nest(files[0]) 186 | 187 | def explain(self) -> _Explanation: 188 | """Explain what this error is.""" 189 | return _Explanation( 190 | explanation="Files were found outside of IDs.", 191 | fix="Files should only be kept in IDs and not higher in the hierarchy.", 192 | ) 193 | 194 | 195 | @dataclass(frozen=True) 196 | class IdDifferentFromJDex: 197 | """An ID with a differently-named JDex entry.""" 198 | 199 | id: str 200 | jdex_name: str 201 | type: Literal["ID_DIFFERENT_FROM_JDEX"] = "ID_DIFFERENT_FROM_JDEX" 202 | 203 | def display(self, files: list[File]) -> str: 204 | """Display this particular instance of an error.""" 205 | return f"{_print_nest(files[0])} [JDex name: {self.jdex_name}]" 206 | 207 | def explain(self) -> _Explanation: 208 | """Explain what this error is.""" 209 | return _Explanation( 210 | explanation="An ID was found, the name of which is different from its corresponding JDex entry.", 211 | fix="Update the one that is incorrect.", 212 | ) 213 | 214 | 215 | @dataclass(frozen=True) 216 | class IdInWrongCategory: 217 | """An ID that, by its number, has been put in the wrong category.""" 218 | 219 | id_ac: str 220 | file_ac: str 221 | type: Literal["ID_IN_WRONG_CATEGORY"] = "ID_IN_WRONG_CATEGORY" 222 | 223 | def display(self, files: list[File]) -> str: 224 | """Display this particular instance of an error.""" 225 | return ( 226 | f"{_print_nest(files[0])} [in {self.file_ac} but should be in {self.id_ac}]" 227 | ) 228 | 229 | def explain(self) -> _Explanation: 230 | """Explain what this error is.""" 231 | return _Explanation( 232 | explanation="Some IDs are in the wrong category.", 233 | fix="Move them into the correct category folder.", 234 | ) 235 | 236 | 237 | @dataclass(frozen=True) 238 | class IdNotInJDex: 239 | """An ID without a corresponding JDex entry.""" 240 | 241 | id: str 242 | type: Literal["ID_NOT_IN_JDEX"] = "ID_NOT_IN_JDEX" 243 | 244 | def display(self, files: list[File]) -> str: 245 | """Display this particular instance of an error.""" 246 | return f"{_print_nest(files[0])} [ID: {self.id}]" 247 | 248 | def explain(self) -> _Explanation: 249 | """Explain what this error is.""" 250 | return _Explanation( 251 | explanation="An ID was found in the files that is missing from the JDex.", 252 | fix="Go add a corresponding entry to your JDex.", 253 | ) 254 | 255 | 256 | @dataclass(frozen=True) 257 | class InvalidAreaName: 258 | """A folder at the area level that doesn't match the normal format.""" 259 | 260 | type: Literal["INVALID_AREA_NAME"] = "INVALID_AREA_NAME" 261 | 262 | def display(self, files: list[File]) -> str: 263 | """Display this particular instance of an error.""" 264 | return _print_nest(files[0]) 265 | 266 | def explain(self) -> _Explanation: 267 | """Explain what this error is.""" 268 | return _Explanation( 269 | explanation="Some areas have invalid names.", 270 | fix='Valid area names look like "10-19 Life Admin", so edit the names to match that format.', 271 | ) 272 | 273 | 274 | @dataclass(frozen=True) 275 | class InvalidCategoryName: 276 | """A folder at the category level that doesn't match the normal format.""" 277 | 278 | type: Literal["INVALID_CATEGORY_NAME"] = "INVALID_CATEGORY_NAME" 279 | 280 | def display(self, files: list[File]) -> str: 281 | """Display this particular instance of an error.""" 282 | return _print_nest(files[0]) 283 | 284 | def explain(self) -> _Explanation: 285 | """Explain what this error is.""" 286 | return _Explanation( 287 | explanation="Some categories have invalid names.", 288 | fix='Valid category names look like "11 Me, Myself, & I", so edit the names to match that format.', 289 | ) 290 | 291 | 292 | @dataclass(frozen=True) 293 | class InvalidIDName: 294 | """A folder at the ID level that doesn't match the normal format.""" 295 | 296 | type: Literal["INVALID_ID_NAME"] = "INVALID_ID_NAME" 297 | 298 | def display(self, files: list[File]) -> str: 299 | """Display this particular instance of an error.""" 300 | return _print_nest(files[0]) 301 | 302 | def explain(self) -> _Explanation: 303 | """Explain what this error is.""" 304 | return _Explanation( 305 | explanation="Some IDs have invalid names.", 306 | fix='Valid ID names look like "11.11 A Cool Project", so edit the names to match that format.', 307 | ) 308 | 309 | 310 | @dataclass(frozen=True) 311 | class NonemptyInbox: 312 | """An inbox (AC.01) that contains items.""" 313 | 314 | num_items: int 315 | type: Literal["NONEMPTY_INBOX"] = "NONEMPTY_INBOX" 316 | 317 | def display(self, files: list[File]) -> str: 318 | """Display this particular instance of an error.""" 319 | return f"{_print_nest(files[0])} [{self.num_items} items]" 320 | 321 | def explain(self) -> _Explanation: 322 | """Explain what this error is.""" 323 | return _Explanation( 324 | explanation="Files were found in an inbox.", 325 | fix="Go sort them into the appropriate IDs.", 326 | ) 327 | 328 | 329 | ErrorType = ( 330 | AreaDifferentFromJDex 331 | | AreaNotInJDex 332 | | CategoryDifferentFromJDex 333 | | CategoryInWrongArea 334 | | CategoryNotInJDex 335 | | DuplicateArea 336 | | DuplicateCategory 337 | | DuplicateId 338 | | FileOutsideId 339 | | IdDifferentFromJDex 340 | | IdInWrongCategory 341 | | IdNotInJDex 342 | | InvalidAreaName 343 | | InvalidCategoryName 344 | | InvalidIDName 345 | | NonemptyInbox 346 | ) 347 | 348 | 349 | @dataclass(frozen=True) 350 | class JDexAreaHeaderDifferentFromArea: 351 | """An area header with a different name than the correspnoding area.""" 352 | 353 | area: str 354 | jdex_name: str 355 | type: Literal["JDEX_AREA_HEADER_DIFFERENT_FROM_AREA"] = ( 356 | "JDEX_AREA_HEADER_DIFFERENT_FROM_AREA" 357 | ) 358 | 359 | def display(self, files: list[File]) -> str: 360 | """Display this particular instance of an error.""" 361 | return f"{_print_nest(files[0])} [JDex name: {self.jdex_name}]" 362 | 363 | def explain(self) -> _Explanation: 364 | """Explain what this error is.""" 365 | return _Explanation( 366 | explanation="An area header was found, the name of which is different from its corresponding JDex entry.", 367 | fix="Update the one that is incorrect.", 368 | ) 369 | 370 | 371 | @dataclass(frozen=True) 372 | class JDexAreaHeaderWithoutArea: 373 | """An area header with no corresponding area.""" 374 | 375 | area: str 376 | type: Literal["JDEX_AREA_HEADER_WITHOUT_AREA"] = "JDEX_AREA_HEADER_WITHOUT_AREA" 377 | 378 | def display(self, files: list[File]) -> str: 379 | """Display this particular instance of an error.""" 380 | return f"{_print_nest(files[0])} [area: {_print_area(self.area)}]" 381 | 382 | def explain(self) -> _Explanation: 383 | """Explain what this error is.""" 384 | return _Explanation( 385 | explanation="An area header was found in the JDex with no corresponding area entry.", 386 | fix="Go add a corresponding entry to your JDex, or delete this header if it is no longer needed.", 387 | ) 388 | 389 | 390 | @dataclass(frozen=True) 391 | class JDexCategoryInWrongArea: 392 | """A JDex category that, by its number, has been put in the wrong area.""" 393 | 394 | category_area: str 395 | file_area: str 396 | type: Literal["JDEX_CATEGORY_IN_WRONG_AREA"] = "JDEX_CATEGORY_IN_WRONG_AREA" 397 | 398 | def display(self, files: list[File]) -> str: 399 | """Given the file's name, print the error message for it.""" 400 | return f"{_print_nest(files[0])} [in {_print_area(self.file_area)} but should be in {_print_area(self.category_area)}]" 401 | 402 | def explain(self) -> _Explanation: 403 | """Explain what this error is.""" 404 | return _Explanation( 405 | explanation="Some JDex categories are in the wrong area.", 406 | fix="Move them into the correct area folder, or use a flat JDex structure.", 407 | ) 408 | 409 | 410 | @dataclass(frozen=True) 411 | class JDexDuplicateArea: 412 | """A JDex area that has been used multiple times.""" 413 | 414 | area: str 415 | type: Literal["JDEX_DUPLICATE_AREA"] = "JDEX_DUPLICATE_AREA" 416 | 417 | def display(self, files: list[File]) -> str: 418 | """Display this particular instance of an error.""" 419 | return f"Area {_print_area(self.area)}:\n " + "\n ".join( 420 | [_print_nest(f) for f in files], 421 | ) 422 | 423 | def explain(self) -> _Explanation: 424 | """Explain what this error is.""" 425 | return _Explanation( 426 | explanation="Duplicate areas were used in the JDex.", 427 | fix="Assign a new area to one of them.", 428 | ) 429 | 430 | 431 | @dataclass(frozen=True) 432 | class JDexDuplicateAreaHeader: 433 | """Multiple headers for the same area.""" 434 | 435 | area: str 436 | type: Literal["JDEX_DUPLICATE_AREA_HEADER"] = "JDEX_DUPLICATE_AREA_HEADER" 437 | 438 | def display(self, files: list[File]) -> str: 439 | """Display this particular instance of an error.""" 440 | return f"Area {_print_area(self.area)}:\n " + "\n ".join( 441 | [_print_nest(f) for f in files], 442 | ) 443 | 444 | def explain(self) -> _Explanation: 445 | """Explain what this error is.""" 446 | return _Explanation( 447 | explanation="Duplicate headers were found for the same area in the JDex.", 448 | fix="Delete the one that is incorrect or fix the area number.", 449 | ) 450 | 451 | 452 | @dataclass(frozen=True) 453 | class JDexDuplicateCategory: 454 | """A JDex category that has been used multiple times.""" 455 | 456 | category: str 457 | type: Literal["JDEX_DUPLICATE_CATEGORY"] = "JDEX_DUPLICATE_CATEGORY" 458 | 459 | def display(self, files: list[File]) -> str: 460 | """Display this particular instance of an error.""" 461 | return ( 462 | self.category + ":\n " + "\n ".join([_print_nest(f) for f in files]) 463 | ) 464 | 465 | def explain(self) -> _Explanation: 466 | """Explain what this error is.""" 467 | return _Explanation( 468 | explanation="Duplicate categories were used in the JDex.", 469 | fix="Assign a new category to one of them.", 470 | ) 471 | 472 | 473 | @dataclass(frozen=True) 474 | class JDexDuplicateId: 475 | """A JDex ID that has been used multiple times.""" 476 | 477 | id: str 478 | type: Literal["JDEX_DUPLICATE_ID"] = "JDEX_DUPLICATE_ID" 479 | 480 | def display(self, files: list[File]) -> str: 481 | """Display this particular instance of an error.""" 482 | return self.id + ":\n " + "\n ".join([_print_nest(f) for f in files]) 483 | 484 | def explain(self) -> _Explanation: 485 | """Explain what this error is.""" 486 | return _Explanation( 487 | explanation="Duplicate IDs were used in the JDex.", 488 | fix="Assign a new ID to one of them.", 489 | ) 490 | 491 | 492 | @dataclass(frozen=True) 493 | class JDexFileOutsideCategory: 494 | """A JDex file was encountered not in a terminal category folder.""" 495 | 496 | type: Literal["JDEX_FILE_OUTSIDE_CATEGORY"] = "JDEX_FILE_OUTSIDE_CATEGORY" 497 | 498 | def display(self, files: list[File]) -> str: 499 | """Display this particular instance of an error.""" 500 | return _print_nest(files[0]) 501 | 502 | def explain(self) -> _Explanation: 503 | """Explain what this error is.""" 504 | return _Explanation( 505 | explanation="JDex files were found outside of categories in a nested structure.", 506 | fix="JDex files should be entirely flat, or nested under area then category.", 507 | ) 508 | 509 | 510 | @dataclass(frozen=True) 511 | class JDexIdInWrongCategory: 512 | """A JDex ID that, by its number, has been put in the wrong category.""" 513 | 514 | id_ac: str 515 | file_ac: str 516 | type: Literal["JDEX_ID_IN_WRONG_CATEGORY"] = "JDEX_ID_IN_WRONG_CATEGORY" 517 | 518 | def display(self, files: list[File]) -> str: 519 | """Display this particular instance of an error.""" 520 | return ( 521 | f"{_print_nest(files[0])} [in {self.file_ac} but should be in {self.id_ac}]" 522 | ) 523 | 524 | def explain(self) -> _Explanation: 525 | """Explain what this error is.""" 526 | return _Explanation( 527 | explanation="Some JDex IDs are in the wrong category.", 528 | fix="Move them into the correct category folder, or use a flat JDex structure.", 529 | ) 530 | 531 | 532 | @dataclass(frozen=True) 533 | class JDexInvalidAreaName: 534 | """A folder at the JDex area level that doesn't match the normal format.""" 535 | 536 | type: Literal["JDEX_INVALID_AREA_NAME"] = "JDEX_INVALID_AREA_NAME" 537 | 538 | def display(self, files: list[File]) -> str: 539 | """Display this particular instance of an error.""" 540 | return _print_nest(files[0]) 541 | 542 | def explain(self) -> _Explanation: 543 | """Explain what this error is.""" 544 | return _Explanation( 545 | explanation="Some JDex areas have invalid names.", 546 | fix='Valid area names look like "10-19 Life Admin", so edit the names to match that format.', 547 | ) 548 | 549 | 550 | @dataclass(frozen=True) 551 | class JDexInvalidCategoryName: 552 | """A folder at the JDex category level that doesn't match the normal format.""" 553 | 554 | type: Literal["JDEX_INVALID_CATEGORY_NAME"] = "JDEX_INVALID_CATEGORY_NAME" 555 | 556 | def display(self, files: list[File]) -> str: 557 | """Display this particular instance of an error.""" 558 | return _print_nest(files[0]) 559 | 560 | def explain(self) -> _Explanation: 561 | """Explain what this error is.""" 562 | return _Explanation( 563 | explanation="Some JDex categories have invalid names.", 564 | fix='Valid category names look like "11 Me, Myself, & I", so edit the names to match that format.', 565 | ) 566 | 567 | 568 | @dataclass(frozen=True) 569 | class JDexInvalidIDName: 570 | """A JDex note that doesn't match the normal format.""" 571 | 572 | type: Literal["JDEX_INVALID_ID_NAME"] = "JDEX_INVALID_ID_NAME" 573 | 574 | def display(self, files: list[File]) -> str: 575 | """Display this particular instance of an error.""" 576 | return _print_nest(files[0]) 577 | 578 | def explain(self) -> _Explanation: 579 | """Explain what this error is.""" 580 | return _Explanation( 581 | explanation="Some JDex IDs have invalid names.", 582 | fix='Valid ID names look like "11.11 A Cool Project", so edit the names to match that format.', 583 | ) 584 | 585 | 586 | JDexErrorType = ( 587 | JDexAreaHeaderDifferentFromArea 588 | | JDexAreaHeaderWithoutArea 589 | | JDexCategoryInWrongArea 590 | | JDexDuplicateArea 591 | | JDexDuplicateAreaHeader 592 | | JDexDuplicateCategory 593 | | JDexDuplicateId 594 | | JDexFileOutsideCategory 595 | | JDexIdInWrongCategory 596 | | JDexInvalidAreaName 597 | | JDexInvalidCategoryName 598 | | JDexInvalidIDName 599 | ) 600 | 601 | 602 | @dataclass(frozen=True) 603 | class File: 604 | """A file or folder that has been detected by jdlint.""" 605 | 606 | name: str 607 | full_path: str 608 | nested_under: list[str] 609 | 610 | 611 | @dataclass(frozen=True) 612 | class _Explanation: 613 | explanation: str 614 | fix: str 615 | 616 | 617 | @dataclass(frozen=True) 618 | class Error: 619 | """A single error detected.""" 620 | 621 | error: ErrorType 622 | files: list[File] 623 | 624 | def type(self) -> str: 625 | """Return the name (type) of the error.""" 626 | return self.error.type 627 | 628 | def display(self) -> str: 629 | """Display this particular instance of an error.""" 630 | return self.error.display(self.files) 631 | 632 | def explain(self) -> _Explanation: 633 | """Explain what this error is.""" 634 | return self.error.explain() 635 | 636 | 637 | @dataclass(frozen=True) 638 | class JDexError: 639 | """A single error detected in the JDex.""" 640 | 641 | error: JDexErrorType 642 | files: list[File] 643 | 644 | def type(self) -> str: 645 | """Return the name (type) of the error.""" 646 | return self.error.type 647 | 648 | def display(self) -> str: 649 | """Display this particular instance of an error.""" 650 | return self.error.display(self.files) 651 | 652 | def explain(self) -> _Explanation: 653 | """Explain what this error is.""" 654 | return self.error.explain() 655 | 656 | 657 | @dataclass(frozen=True) 658 | class LintResults: 659 | """All errors returned from linting files, as well as dictionaries of all areas, categories, and IDs used (and their names).""" 660 | 661 | errors: list[Error] 662 | used_areas: dict[str, list[tuple[str, File]]] 663 | used_categories: dict[str, list[tuple[str, File]]] 664 | used_ids: dict[str, list[tuple[str, File]]] 665 | 666 | 667 | @dataclass 668 | class _JDexAccumulator: 669 | """Accumulator used by _get_jdex_entries to gather information about the JDex.""" 670 | 671 | errors: list[JDexError] 672 | areas: dict[str, list[tuple[str, File]]] 673 | categories: dict[str, list[tuple[str, File]]] 674 | ids: dict[str, list[tuple[str, File]]] 675 | headers: dict[str, list[tuple[str, File]]] 676 | 677 | def __init__(self) -> None: 678 | self.errors = [] 679 | self.areas = {} 680 | self.categories = {} 681 | self.ids = {} 682 | self.headers = {} 683 | 684 | 685 | @dataclass(frozen=True) 686 | class _JDexResults: 687 | """Canonical results from the JDex, featuring the ID and name of each area/category/ID.""" 688 | 689 | areas: dict[str, str] 690 | categories: dict[str, str] 691 | ids: dict[str, str] 692 | 693 | 694 | class _EnhancedJSONEncoder(json.JSONEncoder): 695 | def default(self, o: object) -> object: 696 | # Add JSON encoding for dataclasses and paths 697 | if dataclasses.is_dataclass(o): 698 | return dataclasses.asdict(o) # type: ignore[arg-type] 699 | if isinstance(o, PurePath): 700 | return str(o) 701 | return super().default(o) 702 | 703 | 704 | def _sort_error(e: Error | JDexError) -> tuple[str, list[tuple[list[str], str]]]: 705 | # Sort errors alphabetically by type, then by file/s affected 706 | return ( 707 | e.error.type, 708 | [_sort_file(f) for f in e.files], 709 | ) 710 | 711 | 712 | def _sort_file(f: File) -> tuple[list[str], str]: 713 | # Sort files first by degree of nesting, then alphabetically 714 | return (f.nested_under, f.name) 715 | 716 | 717 | # Any valid area folder name 718 | valid_area_re = re.compile("([0-9])0-(?:\\1)9 (.+)") 719 | # Any valid category folder name 720 | generic_category_re = re.compile("([0-9])[0-9] .+") 721 | # Any valid ID folder name 722 | generic_id_re = re.compile("([0-9][0-9])\\.([0-9][0-9]) (.+)") 723 | # Matches only IDs that are inboxes 724 | inbox_re = re.compile("[0-9][0-9]\\.01 .+") 725 | 726 | 727 | def _valid_category_re(a: str) -> re.Pattern: 728 | """Match only valid categories for a given area.""" 729 | return re.compile("(" + a + "[0-9]) (.+)") 730 | 731 | 732 | def _valid_id_re(ac: str) -> re.Pattern: 733 | """Match only valid IDs for a given area and category.""" 734 | return re.compile("(" + ac + "\\.[0-9][0-9]) (.+)") 735 | 736 | 737 | # Match area header JDex notes 738 | jdex_note_header_re = re.compile("([0-9])0\\. (.+?)(\\.md)?") 739 | # Match any valid ID JDex note 740 | jdex_note_generic_id_re = re.compile("([0-9][0-9])\\.([0-9][0-9]) (.+?)(\\.md)?") 741 | 742 | 743 | def _jdex_note_id_re(ac: str) -> re.Pattern: 744 | """Match only valid JDex note IDs for a given area and category.""" 745 | return re.compile("(" + ac + "\\.[0-9][0-9]) (.+?)(\\.md)?") 746 | 747 | 748 | def _entry_is_ignored( 749 | ignored: list[str] | None, 750 | nested_under: list[str], 751 | f: os.DirEntry, 752 | ) -> bool: 753 | """Check if a given file/directory should be ignored.""" 754 | if not ignored: 755 | return False 756 | p = PurePath(*nested_under, f.name) 757 | return any(p.match(pattern) for pattern in ignored) 758 | 759 | 760 | E = TypeVar("E") 761 | 762 | 763 | def _error_if_dups( # Python's types are horrid and it just is awful to try to type this better 764 | make_error_type: Callable[[str], Any], 765 | make_error: Callable[[Any, list[File]], E], 766 | d: dict[str, list[tuple[Any, File]]], 767 | ) -> list[E]: 768 | return [ 769 | make_error( 770 | make_error_type(k), 771 | sorted([file for (_, file) in v], key=_sort_file), 772 | ) 773 | for k, v in d.items() 774 | if len(v) > 1 775 | ] 776 | 777 | 778 | def _insert_append(k, v, d) -> None: # noqa: ANN001 779 | """Add value as a singleton if it's not already in the dict, else append it to the list.""" 780 | if k not in d: 781 | d.update({k: []}) 782 | 783 | d[k].append(v) 784 | 785 | 786 | def _process_single_file_jdex(path: Path) -> _JDexResults: 787 | """Process a JDex located in a single file.""" 788 | # Matches JDex areas in a single-file format 789 | jdex_line_area_re = re.compile("([0-9])0-(?:\\1)9 (.+?)\\s*(//.*)?") 790 | # Matches JDex categories in a single-file format 791 | jdex_line_category_re = re.compile("([0-9][0-9]) (.+?)\\s*(//.*)?") 792 | # Matches JDex ids in a single-file format 793 | jdex_line_id_re = re.compile("([0-9][0-9].[0-9][0-9]) (.+?)\\s*(//.*)?") 794 | 795 | file_areas = {} 796 | file_categories = {} 797 | file_ids = {} 798 | 799 | with path.open() as jdex_it: 800 | for entry in jdex_it: 801 | area_match = jdex_line_area_re.fullmatch(entry.strip()) 802 | if area_match: 803 | file_areas[area_match.group(1)] = ( 804 | f"{area_match.group(1)}0-09 {area_match.group(2)}" 805 | ) 806 | continue 807 | category_match = jdex_line_category_re.fullmatch(entry.strip()) 808 | if category_match: 809 | file_categories[category_match.group(1)] = ( 810 | f"{category_match.group(1)} {category_match.group(2)}" 811 | ) 812 | continue 813 | id_match = jdex_line_id_re.fullmatch(entry.strip()) 814 | if id_match: 815 | file_ids[id_match.group(1)] = f"{id_match.group(1)} {id_match.group(2)}" 816 | continue 817 | return _JDexResults( 818 | areas=file_areas, 819 | categories=file_categories, 820 | ids=file_ids, 821 | ) 822 | 823 | 824 | def _process_flat_jdex_structure( 825 | files: list[os.DirEntry], 826 | jdex: _JDexAccumulator, 827 | *, 828 | ignored: list[str] | None, 829 | alt_zeros: bool = False, 830 | ) -> None: 831 | """Process a JDex that is a series of flat files.""" 832 | area_re = re.compile( 833 | "0([0-9])\\.00 (.+?)( area management)?( index)?(\\.md)?" 834 | if alt_zeros 835 | else "([0-9])0\\.00 (.+?)( area management)?( index)?(\\.md)?", 836 | flags=re.IGNORECASE, 837 | ) 838 | category_re = re.compile( 839 | # We need to tolerate the "area management" suffix for a category as well, to create categories from e.g. `01.00 Life Admin Area Management` 840 | "([0-9][0-9])\\.00 (.+?)( (category|area) management)?( index)?(\\.md)?" 841 | if alt_zeros 842 | else "([0-9][1-9])\\.00 (.+?)( category management)?( index)?(\\.md)?", 843 | flags=re.IGNORECASE, 844 | ) 845 | 846 | for jid in files: 847 | if _entry_is_ignored(ignored, [], jid): 848 | continue 849 | 850 | file = File(name=jid.name, full_path=jid.path, nested_under=[]) 851 | 852 | # Check if the file matches an area 853 | area_match = area_re.fullmatch(jid.name) 854 | if area_match: 855 | _insert_append( 856 | area_match.group(1), 857 | (area_match.group(2), file), 858 | jdex.areas, 859 | ) 860 | 861 | # Check if the file matches a category 862 | cat_match = category_re.fullmatch(jid.name) 863 | if cat_match: 864 | _insert_append( 865 | cat_match.group(1), 866 | (cat_match.group(2), file), 867 | jdex.categories, 868 | ) 869 | 870 | # Check if it's a header match for alt zeros 871 | header_match = jdex_note_header_re.fullmatch(jid.name) 872 | if header_match: 873 | _insert_append( 874 | header_match.group(1), 875 | (header_match.group(2), file), 876 | jdex.headers, 877 | ) 878 | continue 879 | 880 | # The file should also be a valid ID (or is bad) 881 | id_match = jdex_note_generic_id_re.fullmatch(jid.name) 882 | if id_match: 883 | _insert_append( 884 | f"{id_match.group(1)}.{id_match.group(2)}", 885 | (id_match.group(3), file), 886 | jdex.ids, 887 | ) 888 | else: 889 | jdex.errors.append( 890 | JDexError(error=JDexInvalidIDName(), files=[file]), 891 | ) 892 | 893 | 894 | def _process_nested_jdex_structure( 895 | path: Path, 896 | jdex: _JDexAccumulator, 897 | root_level_files: list[os.DirEntry], 898 | *, 899 | ignored: list[str] | None, 900 | ) -> None: 901 | for area in os.scandir(path): 902 | if _entry_is_ignored(ignored, [], area): 903 | continue 904 | if area.is_file(): 905 | # Maybe we have a flat structure 906 | root_level_files.append(area) 907 | continue 908 | 909 | # Otherwise, a directory, so nested structure 910 | area_file = File(name=area.name, full_path=area.path, nested_under=[]) 911 | area_match = valid_area_re.fullmatch(area.name) 912 | if not area_match: 913 | jdex.errors.append( 914 | JDexError(error=JDexInvalidAreaName(), files=[area_file]), 915 | ) 916 | continue 917 | _insert_append( 918 | area_match.group(1), 919 | (area_match.group(2), area_file), 920 | jdex.areas, 921 | ) 922 | cat_re = _valid_category_re(area_match.group(1)) 923 | with os.scandir(area.path) as cats_it: 924 | for cat in cats_it: 925 | if _entry_is_ignored(ignored, [area.name], cat): 926 | continue 927 | cat_file = File( 928 | name=cat.name, 929 | full_path=cat.path, 930 | nested_under=[area.name], 931 | ) 932 | if cat.is_file(): 933 | jdex.errors.append( 934 | JDexError( 935 | error=JDexFileOutsideCategory(), 936 | files=[cat_file], 937 | ), 938 | ) 939 | continue 940 | 941 | if cat_match := cat_re.fullmatch(cat.name): 942 | _insert_append( 943 | cat_match.group(1), 944 | (cat_match.group(2), cat_file), 945 | jdex.categories, 946 | ) 947 | id_re = _jdex_note_id_re(cat_match.group(1)) 948 | with os.scandir(cat.path) as ids_it: 949 | nested_under = [area.name, cat.name] 950 | for jid in ids_it: 951 | if _entry_is_ignored(ignored, nested_under, jid): 952 | continue 953 | id_file = File( 954 | name=jid.name, 955 | full_path=jid.path, 956 | nested_under=nested_under, 957 | ) 958 | if id_match := id_re.fullmatch(jid.name): 959 | _insert_append( 960 | id_match.group(1), 961 | (id_match.group(2), id_file), 962 | jdex.ids, 963 | ) 964 | elif gen_match := jdex_note_generic_id_re.fullmatch( 965 | jid.name, 966 | ): 967 | jdex.errors.append( 968 | JDexError( 969 | error=JDexIdInWrongCategory( 970 | id_ac=gen_match.group(1), 971 | file_ac=cat_match.group(1), 972 | ), 973 | files=[id_file], 974 | ), 975 | ) 976 | else: 977 | jdex.errors.append( 978 | JDexError( 979 | error=JDexInvalidIDName(), 980 | files=[id_file], 981 | ), 982 | ) 983 | 984 | elif gen_match := generic_category_re.fullmatch(cat.name): 985 | jdex.errors.append( 986 | JDexError( 987 | error=JDexCategoryInWrongArea( 988 | category_area=gen_match.group(1), 989 | file_area=area_match.group(1), 990 | ), 991 | files=[cat_file], 992 | ), 993 | ) 994 | else: 995 | jdex.errors.append( 996 | JDexError(error=JDexInvalidCategoryName(), files=[cat_file]), 997 | ) 998 | 999 | 1000 | def _get_jdex_entries( 1001 | jdex_dir: Path, 1002 | *, 1003 | ignored: list[str] | None, 1004 | alt_zeros: bool = False, 1005 | ) -> _JDexResults | list[JDexError]: 1006 | """Return canonical JDex information or a list of errors for it.""" 1007 | if jdex_dir.is_file(): 1008 | # Single file JDex 1009 | return _process_single_file_jdex(jdex_dir) 1010 | 1011 | jdex: _JDexAccumulator = _JDexAccumulator() 1012 | root_level_files: list[os.DirEntry] = [] 1013 | 1014 | _process_nested_jdex_structure(jdex_dir, jdex, root_level_files, ignored=ignored) 1015 | 1016 | if jdex.ids or jdex.errors: 1017 | # Not a flat structure, so we need to add all root level files as invalid 1018 | jdex.errors.extend( 1019 | [ 1020 | JDexError( 1021 | error=JDexFileOutsideCategory(), 1022 | files=[ 1023 | File( 1024 | name=f.name, 1025 | full_path=f.path, 1026 | nested_under=[], 1027 | ), 1028 | ], 1029 | ) 1030 | for f in root_level_files 1031 | ], 1032 | ) 1033 | 1034 | else: 1035 | # Nothing nested, and not a file, so assume a flat structure 1036 | _process_flat_jdex_structure( 1037 | root_level_files, 1038 | jdex, 1039 | ignored=ignored, 1040 | alt_zeros=alt_zeros, 1041 | ) 1042 | 1043 | # These duplicate errors apply regardless of JDex type 1044 | jdex.errors.extend(_error_if_dups(JDexDuplicateArea, JDexError, jdex.areas)) 1045 | jdex.errors.extend( 1046 | _error_if_dups(JDexDuplicateCategory, JDexError, jdex.categories), 1047 | ) 1048 | jdex.errors.extend(_error_if_dups(JDexDuplicateId, JDexError, jdex.ids)) 1049 | jdex.errors.extend(_error_if_dups(JDexDuplicateAreaHeader, JDexError, jdex.headers)) 1050 | 1051 | for header, files in jdex.headers.items(): 1052 | if header not in jdex.areas: 1053 | jdex.errors.append( 1054 | JDexError( 1055 | error=JDexAreaHeaderWithoutArea(area=header), 1056 | files=[f for (_, f) in files], 1057 | ), 1058 | ) 1059 | elif len(files) == 1 and files[0][0] != jdex.areas[header][0][0]: 1060 | jdex.errors.append( 1061 | JDexError( 1062 | error=JDexAreaHeaderDifferentFromArea( 1063 | area=header, 1064 | jdex_name=f"{_print_area(header)} {jdex.areas[header][0][0]}", 1065 | ), 1066 | files=[f for (_, f) in files], 1067 | ), 1068 | ) 1069 | 1070 | if jdex.errors: 1071 | return jdex.errors 1072 | return _JDexResults( 1073 | areas={k: f"{_print_area(k)} {v[0][0]}" for k, v in jdex.areas.items()}, 1074 | categories={k: f"{k} {v[0][0]}" for k, v in jdex.categories.items()}, 1075 | ids={k: f"{k} {v[0][0]}" for k, v in jdex.ids.items()}, 1076 | ) 1077 | 1078 | 1079 | def lint_dir( 1080 | path: Path, 1081 | ignored: list[str] | None = None, 1082 | ) -> LintResults: 1083 | """Check a root of a JD system for issues.""" 1084 | errors: list[Error] = [] 1085 | used_areas: dict[str, list[tuple[str, File]]] = {} 1086 | used_categories: dict[str, list[tuple[str, File]]] = {} 1087 | used_ids: dict[str, list[tuple[str, File]]] = {} 1088 | 1089 | def check_inbox(nested_under: list[str], f: os.DirEntry) -> None: 1090 | if inbox_re.fullmatch(f.name): 1091 | entries = len(os.listdir(f.path)) 1092 | if entries: 1093 | errors.append( 1094 | Error( 1095 | error=NonemptyInbox(num_items=entries), 1096 | files=[ 1097 | File( 1098 | name=f.name, 1099 | full_path=f.path, 1100 | nested_under=nested_under, 1101 | ), 1102 | ], 1103 | ), 1104 | ) 1105 | 1106 | def check_if_out_of_id(file: os.DirEntry, nested_under: list[str]) -> bool: 1107 | if file.is_file(): 1108 | errors.append( 1109 | Error( 1110 | error=FileOutsideId(), 1111 | files=[ 1112 | File( 1113 | name=file.name, 1114 | full_path=file.path, 1115 | nested_under=nested_under, 1116 | ), 1117 | ], 1118 | ), 1119 | ) 1120 | return True 1121 | return False 1122 | 1123 | with os.scandir(path) as areas_it: 1124 | for area in areas_it: 1125 | if _entry_is_ignored(ignored, [], area) or check_if_out_of_id(area, []): 1126 | continue 1127 | area_file = File( 1128 | name=area.name, 1129 | full_path=area.path, 1130 | nested_under=[], 1131 | ) 1132 | area_match = valid_area_re.fullmatch(area.name) 1133 | if not area_match: 1134 | errors.append( 1135 | Error( 1136 | error=InvalidAreaName(), 1137 | files=[area_file], 1138 | ), 1139 | ) 1140 | continue 1141 | # Valid area 1142 | _insert_append( 1143 | area_match.group(1), 1144 | (area_match.group(2), area_file), 1145 | used_areas, 1146 | ) 1147 | cat_re = _valid_category_re(area_match.group(1)) 1148 | with os.scandir(area.path) as cats_it: 1149 | for cat in cats_it: 1150 | if _entry_is_ignored( 1151 | ignored, 1152 | [area.name], 1153 | cat, 1154 | ) or check_if_out_of_id(cat, [area.name]): 1155 | continue 1156 | cat_file = File( 1157 | name=cat.name, 1158 | full_path=cat.path, 1159 | nested_under=[area.name], 1160 | ) 1161 | if cat_match := cat_re.fullmatch(cat.name): 1162 | _insert_append( 1163 | cat_match.group(1), 1164 | (cat_match.group(2), cat_file), 1165 | used_categories, 1166 | ) 1167 | id_re = _valid_id_re(cat_match.group(1)) 1168 | with os.scandir(cat.path) as ids_it: 1169 | nested_under = [area.name, cat.name] 1170 | 1171 | for jid in ids_it: 1172 | if _entry_is_ignored( 1173 | ignored, 1174 | nested_under, 1175 | jid, 1176 | ) or check_if_out_of_id(jid, nested_under): 1177 | continue 1178 | id_file = File( 1179 | name=jid.name, 1180 | full_path=jid.path, 1181 | nested_under=nested_under, 1182 | ) 1183 | if id_match := id_re.fullmatch(jid.name): 1184 | _insert_append( 1185 | id_match.group(1), 1186 | (id_match.group(2), id_file), 1187 | used_ids, 1188 | ) 1189 | 1190 | check_inbox(nested_under, jid) 1191 | elif gen_match := generic_id_re.fullmatch(jid.name): 1192 | errors.append( 1193 | Error( 1194 | error=IdInWrongCategory( 1195 | id_ac=gen_match.group( 1196 | 1, 1197 | ), 1198 | file_ac=cat_match.group( 1199 | 1, 1200 | ), 1201 | ), 1202 | files=[id_file], 1203 | ), 1204 | ) 1205 | 1206 | else: 1207 | errors.append( 1208 | Error( 1209 | error=InvalidIDName(), 1210 | files=[id_file], 1211 | ), 1212 | ) 1213 | elif gen_match := generic_category_re.fullmatch(cat.name): 1214 | errors.append( 1215 | Error( 1216 | error=CategoryInWrongArea( 1217 | category_area=gen_match.group(1), 1218 | file_area=area_match.group(1), 1219 | ), 1220 | files=[cat_file], 1221 | ), 1222 | ) 1223 | else: 1224 | errors.append( 1225 | Error( 1226 | error=InvalidCategoryName(), 1227 | files=[cat_file], 1228 | ), 1229 | ) 1230 | 1231 | errors.extend(_error_if_dups(DuplicateArea, Error, used_areas)) 1232 | errors.extend(_error_if_dups(DuplicateCategory, Error, used_categories)) 1233 | errors.extend(_error_if_dups(DuplicateId, Error, used_ids)) 1234 | 1235 | return LintResults( 1236 | errors=sorted(errors, key=_sort_error), 1237 | used_areas=used_areas, 1238 | used_categories=used_categories, 1239 | used_ids=used_ids, 1240 | ) 1241 | 1242 | 1243 | def lint_dir_and_jdex( 1244 | *, 1245 | path: Path, 1246 | jdex_path: Path, 1247 | ignored: list[str] | None = None, 1248 | alt_zeros: bool = False, 1249 | ) -> tuple[list[Error], list[JDexError]]: 1250 | """Check a root of a JD system and its JDex for issues.""" 1251 | results = lint_dir(path, ignored) 1252 | jdex = _get_jdex_entries(jdex_path, ignored=ignored, alt_zeros=alt_zeros) 1253 | if isinstance(jdex, list): 1254 | return (results.errors, sorted(jdex, key=_sort_error)) 1255 | 1256 | errors = results.errors 1257 | 1258 | for area, files in results.used_areas.items(): 1259 | if area not in jdex.areas: 1260 | errors.append( 1261 | Error( 1262 | error=AreaNotInJDex(area=area), 1263 | files=[f for (_, f) in files], 1264 | ), 1265 | ) 1266 | elif len(files) == 1 and files[0][1].name != jdex.areas[area]: 1267 | errors.append( 1268 | Error( 1269 | error=AreaDifferentFromJDex( 1270 | area=area, 1271 | jdex_name=jdex.areas[area], 1272 | ), 1273 | files=[f for (_, f) in files], 1274 | ), 1275 | ) 1276 | for category, files in results.used_categories.items(): 1277 | if category not in jdex.categories: 1278 | errors.append( 1279 | Error( 1280 | error=CategoryNotInJDex(category=category), 1281 | files=[f for (_, f) in files], 1282 | ), 1283 | ) 1284 | elif len(files) == 1 and files[0][1].name != jdex.categories[category]: 1285 | errors.append( 1286 | Error( 1287 | error=CategoryDifferentFromJDex( 1288 | category=category, 1289 | jdex_name=jdex.categories[category], 1290 | ), 1291 | files=[f for (_, f) in files], 1292 | ), 1293 | ) 1294 | for jid, files in results.used_ids.items(): 1295 | if jid not in jdex.ids: 1296 | errors.append( 1297 | Error(error=IdNotInJDex(id=jid), files=[f for (_, f) in files]), 1298 | ) 1299 | elif len(files) == 1 and files[0][1].name != jdex.ids[jid]: 1300 | errors.append( 1301 | Error( 1302 | error=IdDifferentFromJDex(id=jid, jdex_name=jdex.ids[jid]), 1303 | files=[f for (_, f) in files], 1304 | ), 1305 | ) 1306 | return (sorted(errors, key=_sort_error), []) 1307 | 1308 | 1309 | def _print_area(d: str) -> str: 1310 | """Given the number of an area, pretty-print it.""" 1311 | return f"{d}0-{d}9" 1312 | 1313 | 1314 | def _print_nest(f: File) -> str: 1315 | """Pretty-print a nested file.""" 1316 | if f.nested_under: 1317 | return str(PurePath(*f.nested_under, f.name)) 1318 | return f.name 1319 | 1320 | 1321 | if __name__ == "__main__": 1322 | parser = argparse.ArgumentParser( 1323 | prog="jdlint", 1324 | description="Ensure that your Johnny Decimal system is neat and clean", 1325 | ) 1326 | parser.add_argument( 1327 | "path", 1328 | metavar="ROOT_PATH", 1329 | help='The root of a JD file structure; should contain folders called e.g. "10-19 Life Admin"', 1330 | ) 1331 | parser.add_argument( 1332 | "--jdex", 1333 | "--index", 1334 | metavar="JDEX_FILES", 1335 | help="Folder containing your JDex/index notes", 1336 | ) 1337 | parser.add_argument( 1338 | "-i", 1339 | "--ignore", 1340 | dest="ignored", 1341 | action="append", 1342 | metavar="IGNORED_FILE", 1343 | default=[], 1344 | help="A file/directory name/pattern to ignore if it is encountered", 1345 | ) 1346 | parser.add_argument( 1347 | "-d", 1348 | "--disable", 1349 | dest="disable", 1350 | action="append", 1351 | metavar="RULE_TO_DISABLE", 1352 | default=[], 1353 | help="A rule to disable by name, e.g. NONEMPTY_INBOX", 1354 | ) 1355 | parser.add_argument( 1356 | "-j", 1357 | "--json", 1358 | dest="json", 1359 | action="store_const", 1360 | const=True, 1361 | help="Output as machine-readable JSON", 1362 | ) 1363 | parser.add_argument( 1364 | "--altzeros", 1365 | dest="altzeros", 1366 | action="store_const", 1367 | const=True, 1368 | help="Specify use of the alternative standard zeros layout; see the README for more info", 1369 | ) 1370 | 1371 | args = parser.parse_args() 1372 | 1373 | # Get all errors 1374 | if args.jdex: 1375 | (errors, jdex_errors) = lint_dir_and_jdex( 1376 | path=Path(args.path), 1377 | jdex_path=Path(args.jdex), 1378 | ignored=args.ignored, 1379 | alt_zeros=args.altzeros, 1380 | ) 1381 | else: 1382 | errors = (lint_dir(args.path, args.ignored)).errors 1383 | jdex_errors = [] 1384 | 1385 | # Filter disabled errors 1386 | errors = [e for e in errors if e.type() not in args.disable] 1387 | jdex_errors = [e for e in jdex_errors if e.type() not in args.disable] 1388 | 1389 | # If there were issues 1390 | if errors or jdex_errors: 1391 | # Dump to JSON if asked 1392 | if args.json: 1393 | json.dump( 1394 | {"errors": errors, "jdex_errors": jdex_errors}, 1395 | sys.stdout, 1396 | cls=_EnhancedJSONEncoder, 1397 | ) 1398 | 1399 | # Or print them out 1400 | else: 1401 | # Group errors by type and then by type details 1402 | # Since all explanations are identical, there's no reason to print them multiple times 1403 | jdex_errs_by_type: dict[str, dict[JDexErrorType, list[JDexError]]] = {} 1404 | for je in jdex_errors: 1405 | if je.error.type not in jdex_errs_by_type: 1406 | jdex_errs_by_type.update({je.error.type: {}}) 1407 | _insert_append(je.error, je, jdex_errs_by_type[je.error.type]) 1408 | 1409 | errs_by_type: dict[str, dict[ErrorType, list[Error]]] = {} 1410 | for e in errors: 1411 | if e.error.type not in errs_by_type: 1412 | errs_by_type.update({e.error.type: {}}) 1413 | _insert_append(e.error, e, errs_by_type[e.error.type]) 1414 | 1415 | # Print JDex errors if any 1416 | if jdex_errors: 1417 | print("JDex errors found:") 1418 | for je_type in jdex_errs_by_type.values(): 1419 | first_j_err = next(iter(je_type.keys())) # Just get the first error 1420 | explanation = first_j_err.explain() 1421 | print(f"\n{explanation.explanation} ({first_j_err.type})") 1422 | print( 1423 | "\n".join( 1424 | [ 1425 | " " + e.display() 1426 | for jes in je_type.values() 1427 | for e in jes 1428 | ], 1429 | ), 1430 | ) 1431 | print(explanation.fix) 1432 | print("\n") 1433 | 1434 | # Print file errors if any 1435 | if errors: 1436 | print("Errors found:") 1437 | for e_type in errs_by_type.values(): 1438 | first_err = next(iter(e_type.keys())) # Just get the first error 1439 | explanation = first_err.explain() 1440 | print(f"\n{explanation.explanation} ({first_err.type})") 1441 | print( 1442 | "\n".join( 1443 | [" " + e.display() for es in e_type.values() for e in es], 1444 | ), 1445 | ) 1446 | print(explanation.fix) 1447 | print("\n") 1448 | 1449 | # Exit unhappily 1450 | sys.exit(1) 1451 | 1452 | # If we're here, there were no issues 1453 | print("Everything looks good!") 1454 | 1455 | sys.exit(0) 1456 | --------------------------------------------------------------------------------