The clean & modern RSS server that doesn't give you any crap. https://thearsse.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
3.9KB

  1. <?php
  2. /** @license MIT
  3. * Copyright 2017 J. King, Dustin Wilson et al.
  4. * See LICENSE and AUTHORS files for details */
  5. declare(strict_types=1);
  6. namespace JKingWeb\Arsse;
  7. const BASE = __DIR__.DIRECTORY_SEPARATOR;
  8. $paths = [
  9. __FILE__,
  10. BASE."arsse.php",
  11. BASE."RoboFile.php",
  12. BASE."lib",
  13. BASE."tests",
  14. ];
  15. $rules = [
  16. // house rules where PSR series is silent
  17. 'align_multiline_comment' => ['comment_type' => "phpdocs_only"],
  18. 'array_syntax' => ['syntax' => "short"],
  19. 'binary_operator_spaces' => [
  20. 'default' => "single_space",
  21. 'operators' => ['=>' => "align_single_space"],
  22. ],
  23. 'cast_spaces' => ['space' => "single"],
  24. 'concat_space' => ['spacing' => "none"],
  25. 'list_syntax' => ['syntax' => "short"],
  26. 'magic_constant_casing' => true,
  27. 'magic_method_casing' => true,
  28. 'modernize_types_casting' => true,
  29. 'native_function_casing' => true,
  30. 'native_function_type_declaration_casing' => true,
  31. 'no_binary_string' => true,
  32. 'no_blank_lines_after_phpdoc' => true,
  33. 'no_empty_comment' => true,
  34. 'no_empty_phpdoc' => true,
  35. 'no_extra_blank_lines' => true, // this could probably use more configuration
  36. 'no_mixed_echo_print' => ['use' => "echo"],
  37. 'no_short_bool_cast' => true,
  38. 'no_trailing_comma_in_singleline_array' => true,
  39. 'no_unneeded_control_parentheses' => true,
  40. 'no_unneeded_curly_braces' => true,
  41. 'no_unused_imports' => true,
  42. 'no_whitespace_before_comma_in_array' => true,
  43. 'normalize_index_brace' => true,
  44. 'object_operator_without_whitespace' => true,
  45. 'pow_to_exponentiation' => true,
  46. 'set_type_to_cast' => true,
  47. 'standardize_not_equals' => true,
  48. 'trailing_comma_in_multiline_array' => true,
  49. 'unary_operator_spaces' => true,
  50. 'yoda_style' => false,
  51. // PSR standard to apply
  52. '@PSR2' => true,
  53. // PSR-12 rules; php-cs-fixer does not yet support PSR-12 natively
  54. 'compact_nullable_typehint' => true,
  55. 'declare_equal_normalize' => ['space' => "none"],
  56. 'function_typehint_space' => true,
  57. 'lowercase_cast' => true,
  58. 'lowercase_static_reference' => true,
  59. 'no_alternative_syntax' => true,
  60. 'no_empty_statement' => true,
  61. 'no_leading_import_slash' => true,
  62. 'no_leading_namespace_whitespace' => true,
  63. 'no_whitespace_in_blank_line' => true,
  64. 'return_type_declaration' => ['space_before' => "none"],
  65. 'single_trait_insert_per_statement' => true,
  66. 'short_scalar_cast' => true,
  67. 'visibility_required' => ['elements' => ["const", "property", "method"]],
  68. // house exceptions to PSR rules
  69. 'braces' => ['position_after_functions_and_oop_constructs' => "same"],
  70. 'function_declaration' => ['closure_function_spacing' => "none"],
  71. 'new_with_braces' => false, // no option to specify absence of braces
  72. ];
  73. $finder = \PhpCsFixer\Finder::create();
  74. foreach ($paths as $path) {
  75. if (is_file($path)) {
  76. $finder = $finder->append([$path]);
  77. } else {
  78. $finder = $finder->in($path);
  79. }
  80. }
  81. return \PhpCsFixer\Config::create()->setRiskyAllowed(true)->setRules($rules)->setFinder($finder);