-
Notifications
You must be signed in to change notification settings - Fork 297
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
Add new bot: cut string by delimeter, max length #1967
Conversation
There was a problem hiding this 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?
Codecov Report
@@ 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
|
There was a problem hiding this 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.
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 :/ |
Add new bot: cut string by delimeter, max length