Skip to content

Feature Request: Support for Packer HCL code #584

@HariSekhon

Description

@HariSekhon

Feature Request to support Packer HCL.

It's just come to my attention that scc does not detect Packer HCL code such as in my HariSekhon/Packer repo:

git clone https://github.com/HariSekhon/Packer
cd Packer

It does not detect HCL files:

$ scc .
───────────────────────────────────────────────────────────────────────────────
Language                 Files     Lines   Blanks  Comments     Code Complexity
───────────────────────────────────────────────────────────────────────────────
Shell                       27      1203      197       495      511         73
YAML                        13       740       86       243      411          0
XML                          4        38        0         0       38          0
BASH                         2       248       41       131       76         17
Markdown                     2       233       68         0      165          0
License                      1         7        3         0        4          0
Makefile                     1       523       83        26      414         39
Properties File              1        42        9        20       13          0
Ruby                         1        30        1        24        5          0
───────────────────────────────────────────────────────────────────────────────
Total                       52      3064      488       939     1637        129
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop (organic) $45,325
Estimated Schedule Effort (organic) 4.24 months
Estimated People Required (organic) 0.95
───────────────────────────────────────────────────────────────────────────────
Processed 93762 bytes, 0.094 megabytes (SI)

But there are 3k lines of HCL, nearly double the total that scc has detected:

$ wc -l *.pkr.hcl
     336 aws_eks.amazonlinux2.x86_64.pkr.hcl
     135 debian-arm64.qemu.pkr.hcl
     109 debian-arm64.tart.http.pkr.hcl
     129 debian-arm64.tart.pkr.hcl
     136 debian-x86_64.qemu.pkr.hcl
     125 debian-x86_64.vbox.pkr.hcl
     135 fedora-arm64.qemu.pkr.hcl
     116 fedora-arm64.tart.http.pkr.hcl
     133 fedora-arm64.tart.pkr.hcl
     134 fedora-x86_64.qemu.pkr.hcl
     133 fedora-x86_64.vbox.pkr.hcl
     135 rocky-arm64.qemu.pkr.hcl
     118 rocky-arm64.tart.http.pkr.hcl
     134 rocky-arm64.tart.pkr.hcl
     134 rocky-x86_64.qemu.pkr.hcl
     131 rocky-x86_64.vbox.pkr.hcl
     151 ubuntu-arm64.qemu.pkr.hcl
     145 ubuntu-arm64.tart.http.pkr.hcl
     143 ubuntu-arm64.tart.pkr.hcl
     144 ubuntu-x86_64.qemu.pkr.hcl
     148 ubuntu-x86_64.vbox.pkr.hcl
    3004 total

cloc does though:

$ cloc .
      92 text files.
      75 unique files.                              
      20 files ignored.

github.com/AlDanial/cloc v 2.02  T=0.02 s (3007.9 files/s, 249137.2 lines/s)
--------------------------------------------------------------------------------
Language                      files          blank        comment           code
--------------------------------------------------------------------------------
HCL                              21            320           1032           1652
Bourne Shell                     27            197            468            538
make                              1             82             27            414
YAML                             13             86            243            411
Markdown                          2             68             12            153
XML                               6              0              0            104
Bourne Again Shell                2             41            129             78
INI                               1             13              0             72
Properties                        1              9             20             13
Ruby                              1              1             23              6
--------------------------------------------------------------------------------
SUM:                             75            817           1954           3441
--------------------------------------------------------------------------------

Checking another HCL repo of HariSekhon/Terraform it does detect the HCL there though:

$ git clone https://github.com/HariSekhon/Terraform
cd Terraform
$ scc . 
───────────────────────────────────────────────────────────────────────────────
Language                 Files     Lines   Blanks  Comments     Code Complexity
───────────────────────────────────────────────────────────────────────────────
Terraform                  206     22224     3648      3289    15287       2868
YAML                        42      1865      170       524     1171          0
Markdown                    34      7472     1743         0     5729          0
Shell                       10       676      105        94      477         46
Smarty Template              9       213        3         0      210         46
License                      4       395       63         0      332          0
BASH                         3       304       51       161       92         20
Makefile                     3        90       20        12       58          1
SVG                          2         2        0         0        2          0
JSON                         1        45        0         0       45          0
Ruby                         1        30        1        24        5          0
───────────────────────────────────────────────────────────────────────────────
Total                      315     33316     5804      4104    23408       2981
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop (organic) $740,334
Estimated Schedule Effort (organic) 12.27 months
Estimated People Required (organic) 5.36
───────────────────────────────────────────────────────────────────────────────
Processed 1471855 bytes, 1.472 megabytes (SI)
───────────────────────────────────────────────────────────────────────────────

Not sure if it's a bug that it misses the HCL in my Packer repo yet finds it in my Terraform repo or where it's a missing feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    DONE

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions