Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new bot: cut string by delimeter, max length #1967

Merged

Conversation

mariuskarotkis
Copy link
Contributor

Add new bot: cut string by delimeter, max length

@ghost ghost self-assigned this Jun 7, 2021
@ghost ghost added the feature request Indicates new feature requests label Jun 7, 2021
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making a string shorter in the Python world is usually called truncating (see for example the jinja2 truncate filter), so calling the bot something like TruncateByDelimiter is maybe a more descriptive name.

Please also add a reuse compliant license and copyright header to the files.

As a long term solution it might make more sense to implement a separate bot for string field manipulation, like a JinjaBot which then can do all the jinja filters and which would make it easier to add custom filters. @wagner-certat what do you think?

intelmq/bots/experts/string_cut_delimiter/expert.py Outdated Show resolved Hide resolved
intelmq/bots/experts/string_cut_delimiter/expert.py Outdated Show resolved Hide resolved
intelmq/bots/experts/string_cut_delimiter/expert.py Outdated Show resolved Hide resolved
intelmq/bots/experts/string_cut_delimiter/expert.py Outdated Show resolved Hide resolved
intelmq/bots/experts/string_cut_delimiter/expert.py Outdated Show resolved Hide resolved
@ghost ghost removed their assignment Jun 17, 2021
@codecov-commenter
Copy link

codecov-commenter commented Aug 4, 2021

Codecov Report

Merging #1967 (4005eed) into develop (0750a3d) will increase coverage by 0.31%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop    #1967      +/-   ##
===========================================
+ Coverage    75.74%   76.06%   +0.31%     
===========================================
  Files          414      425      +11     
  Lines        22169    22825     +656     
  Branches      2944     3024      +80     
===========================================
+ Hits         16793    17361     +568     
- Misses        4697     4757      +60     
- Partials       679      707      +28     
Impacted Files Coverage Δ
...telmq/bots/experts/truncate_by_delimiter/expert.py 100.00% <100.00%> (ø)
.../bots/experts/truncate_by_delimiter/test_expert.py 100.00% <100.00%> (ø)
intelmq/tests/bots/experts/wait/test_expert.py 50.00% <0.00%> (-50.00%) ⬇️
intelmq/bots/experts/wait/expert.py 48.57% <0.00%> (-31.43%) ⬇️
intelmq/bots/parsers/cert_eu/parser_csv.py 78.84% <0.00%> (-2.79%) ⬇️
intelmq/bots/parsers/misp/parser.py 85.45% <0.00%> (-2.79%) ⬇️
intelmq/lib/upgrades.py 69.01% <0.00%> (-1.18%) ⬇️
intelmq/lib/test.py 91.51% <0.00%> (-0.32%) ⬇️
intelmq/tests/test_conf.py 95.38% <0.00%> (-0.07%) ⬇️
intelmq/bin/intelmqctl.py 12.84% <0.00%> (-0.05%) ⬇️
... and 408 more

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a license header like

# SPDX-FileCopyrightText: 2018 <your name/mailaddress>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

to

  • intelmq/bots/experts/truncate_by_delimiter/expert.py
  • intelmq/tests/bots/experts/truncate_by_delimiter/test_expert.py
    Thanks

Please describe better, how the bot works so that it's not necessary to study the code before using it. It's not clear from the current docs how delimiter and max_length work together. Maybe add some usage examples which demonstrate it's capabilities, e.g. with max_length = 0 and max_length > 0, and a.b.c.example.com with max_length = 13 and = 15.

@ghost ghost self-assigned this Aug 6, 2021
@ghost ghost added this to the 3.1.0 milestone Aug 6, 2021
@ghost ghost merged commit dd15c62 into certtools:develop Aug 6, 2021
@ghost
Copy link

ghost commented Aug 6, 2021

Thanks again for your contribution! And sorry for the long waiting time - several issues at the same time forced us to set the focus elsewhere :/

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants