seaofvoices / darklua

A command line tool that transforms Lua code
https://darklua.com/
MIT License
71 stars 9 forks source link

Add parameter to skip comments with the `remove_comments` rule #194

Closed jeparlefrancais closed 3 months ago

jeparlefrancais commented 3 months ago

Closes #173

These changes add a except parameter to the remove_comments rule. This makes it possible to avoid removing --!native comments.

github-actions[bot] commented 3 months ago

Coverage after merging remove-comments-exceptions into main will be

86.93%

Coverage Report for Changed Files
FileStmtsBranchesFuncsLinesUncovered Lines
src
   parser.rs86.96%100%94.12%85.95%21–22, 29–30, 521–527, 69–73, 80
src/nodes
   arguments.rs79.31%100%82.61%78.49%108–112, 114, 144, 148–151, 153, 34–36, 64–66, 85–86
   block.rs97.47%100%96.43%97.62%171–173, 208–213
   function_body.rs100%100%100%100%
   function_call.rs90.80%100%88.24%91.43%104–106, 94–96
   identifier.rs94.29%100%91.67%94.83%63–65
   mod.rs100%100%100%100%108–109, 60–61, 92–93, 98–99
   token.rs92.64%100%94.12%92.39%194, 200–202, 21–26, 262, 68, 77, 90
   typed_identifier.rs100%100%100%100%
src/nodes/expressions
   binary.rs95.53%100%100%95.10%57–59, 67–69, 71–73, 77–78, 87
   field.rs100%100%100%100%
   function.rs91.76%100%91.18%91.91%131–133, 191–193, 42–45, 91
   if_expression.rs93.08%100%92.31%93.27%100–102, 29–32
   index.rs100%100%100%100%
   interpolated_string.rs85.37%100%87.50%84.85%136–139, 141, 143–146, 148, 176–178, 267–272, 48–50
   mod.rs76.29%100%75.68%76.43%136–138, 142–144, 148–150, 154–156, 160–162, 166–168, 184–186, 190–192, 268, 320–323, 325, 92–97
   number.rs90.59%100%91.78%90.33%209–213, 215, 225–229, 231–232, 284–288, 290, 321–329, 331, 384
   parenthese.rs88.89%100%87.50%89.29%58–60
   string.rs95.74%100%92.11%96.45%49, 51, 94–96
   table.rs89.62%100%92.50%88.95%151–155, 186–187, 191–195, 197, 281–283, 46–48
   type_cast.rs83.33%100%80%84.21%23–25, 31–33
   unary.rs100%100%100%100%
src/nodes/statements
   assign.rs100%100%100%100%
   compound_assign.rs91.89%100%91.67%91.94%105–107, 22, 35
   do_statement.rs100%100%100%100%
   function.rs96.88%100%96%97.09%100, 312–314, 98–99
   generic_for.rs100%100%100%100%
   if_statement.rs81.10%100%84.38%80.30%160–165, 167–169, 171–172, 185–187, 195–198, 31–37
   last_statement.rs100%100%100%100%
   local_assign.rs97.34%100%97.30%97.35%179, 76–79
   local_function.rs95.31%100%95.12%95.35%104–108, 222–224
   mod.rs100%100%100%100%
   numeric_for.rs95.40%100%94.12%95.71%124–126
   repeat_statement.rs100%100%100%100%
   type_declaration.rs54.45%100%80.95%51.18%117–123, 125–133, 135–138, 141–142, 144–150, 152–160, 162–165, 168–169, 204, 206–214, 216–219, 225–231, 233–241, 243–246, 249–250, 93–95
   while_statement.rs100%100%100%100%
src/nodes/types
   array.rs100%100%100%100%
   expression_type.rs100%100%100%100%
   function.rs91.76%100%94.59%90.98%164–172, 52–54
   generics.rs86.19%100%85.71%86.28%106–108, 114–116, 122–124, 264–266, 28–30, 366, 385, 393, 408, 43–44, 448–449, 45, 450, 473–475, 479–481, 485–487, 491–493, 670–674, 677–678, 680–686
   intersection.rs100%100%100%100%
   mod.rs90.63%100%93.33%89.80%75–78, 80
   optional.rs100%100%100%100%
   parenthese.rs87.50%100%85.71%88%45–47
   string_type.rs56.86%100%58.33%56.41%13–17, 46–48, 51–53, 56–58, 61–63
   table.rs75.70%100%78.72%75%166–168, 186–190, 192, 194–198, 200, 210–214, 216, 218–222, 224, 252–260, 304–306, 318–322, 330–332, 92–94
   type_field.rs89.19%100%87.50%89.66%33–35
   type_name.rs79.53%100%77.78%80%104–106, 114–116, 144–146, 162–164, 33–34, 48–50, 89–91
   type_pack.rs85.54%100%84.21%85.94%105–107, 64–66, 84–86
   union.rs100%100%100%100%
   variadic_type_pack.rs75%100%71.43%76%41–43, 46–48
src/rules
   remove_comments.rs38.95%100%29.05%42.27%159–161, 165–170, 172, 174, 176–178, 180–182, 184–186, 188–190, 192–194, 196–198, 200–202, 204–206, 208–210, 212–214, 216–218, 220–222, 224–226, 228–230, 258–262, 264–266, 268–270, 276–278, 280–282, 284–286, 288–293, 295–296, 299, 301–303, 305–307, 309–311, 313–315, 317–319, 321–323, 325–333, 348, 350, 352–354, 356–358, 360–362, 364–366, 368–370, 372–374, 376–378, 380–382, 384–386, 388–390, 392–394, 396–401, 403–405, 407, 409–414, 416, 418, 420–422, 424–426, 428–430, 432–434, 436–438, 440–442, 444–446, 448–450, 452–454, 456–458, 460–462, 464–466, 468–470, 472–474, 77–79
   rule_property.rs88.68%100%96%87.31%124–129, 131–134, 138–139, 29, 37, 48, 64, 82